Skip to content

Instantly share code, notes, and snippets.

@joferkington
Created August 28, 2015 18:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save joferkington/a97452653017f774ae4b to your computer and use it in GitHub Desktop.
Save joferkington/a97452653017f774ae4b to your computer and use it in GitHub Desktop.
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