Created
September 30, 2014 20:28
-
-
Save dnase/f8bbfeb3d0c7e6449702 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Not "Pythonic" | |
if 'keyname' in item.keys(): | |
return item['keyname'] | |
return None | |
# Is "Pythonic" | |
try: | |
return item['keyname'] | |
except KeyError: | |
pass | |
return None | |
# W. T. F. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment