Skip to content

Instantly share code, notes, and snippets.

@edofic
Created January 7, 2016 14:38
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 edofic/56eae1571c66e4461212 to your computer and use it in GitHub Desktop.
Save edofic/56eae1571c66e4461212 to your computer and use it in GitHub Desktop.
computed properties on python modules
import sys
class Hack(object):
bar = 2
@property
def foo(self):
return 1
sys.modules['hack'] = Hack()
@edofic
Copy link
Author

edofic commented Jan 7, 2016

import hack
hack.foo  # 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment