Skip to content

Instantly share code, notes, and snippets.

@hktechn0
Created February 7, 2010 18:45
Show Gist options
  • Save hktechn0/297589 to your computer and use it in GitHub Desktop.
Save hktechn0/297589 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
def test():
print "Hello."
return True
a = {10 : "0x1010"}
# k in a
print a.get(10, test()) # :True
print a.get(100, test()) # :False
# Result:
# Hello.
# 0x1010
# Hello.
# True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment