Skip to content

Instantly share code, notes, and snippets.

@christianp
Created February 10, 2015 15:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christianp/0a4706c800084bd384a4 to your computer and use it in GitHub Desktop.
Save christianp/0a4706c800084bd384a4 to your computer and use it in GitHub Desktop.
Python gives up finding the attribute before evaluating arguments
a = {}
def b():
print("b")
a.q(b()) # gives an AttributeError, doesn't call b
a['q'](b()) # gives a KeyError, doesn't call b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment