Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Lovely dynamic typing
import random
class BadIdea(object):
def __getattr__(self, key):
return random.randint(0, 1000)
def __setattr__(self, key, value):
pass
x = BadIdea()
print x.bar
x.bar = 10
print x.bar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.