Created
March 18, 2015 14:28
-
-
Save idank/364ccc16da98a4d94132 to your computer and use it in GitHub Desktop.
This file contains 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
# BAD, not backward compatiable | |
def decode_message(msg): | |
arg1 = msg['arg1'] | |
.. | |
argn = msg['argn'] | |
do_work(arg1, .., argn) | |
# OK | |
def decode_message(msg): | |
# arg1 might be deleted, or not exist at all | |
arg1 = msg.get('arg1', <some-sensible-default>) | |
.. | |
do_work(arg1, ..) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment