Dictionaries

1. Unpythonic

1. Pythonic

1. Unpythonic

1. Pythonic

1. Unpythonic

1. Pythonic

Keys

1. Unpythonic

1. Pythonic

2. Unpythonic

2. Pythonic

3. Unpythonic
Version 1.

Version 2.

3. Pythonic

reason: mydict.get(key, DEFAULT_VALUE)

3. Pythonic alternative

More Clearly …

2. Unpythonic

2. Pythonic

the “with statement” will close all file descriptor when leaving the “with block”

2. Unpythonic

2. Pythonic

2. Unpythonic

2. Pythonic

About Gugulethu Ncube

IT enthusiast getting things done.