Skip to content

Instantly share code, notes, and snippets.

@startling
Created May 4, 2012 22:43
Show Gist options
  • Save startling/2598169 to your computer and use it in GitHub Desktop.
Save startling/2598169 to your computer and use it in GitHub Desktop.
metaclasses explained
class FalseClass(type):
def __int__(self):
return 13
class C(object):
__metaclass__ = FalseClass
print int(C)
c = C()
# this raises an error, since c.__int__ doesn't exist;
# it's an instance of a class, not a class itself.
print int(c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment