Skip to content

Instantly share code, notes, and snippets.

@ThiefMaster
Created May 25, 2014 13:34
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 ThiefMaster/3c101347fd6267b5ca09 to your computer and use it in GitHub Desktop.
Save ThiefMaster/3c101347fd6267b5ca09 to your computer and use it in GitHub Desktop.
>>> class Foo(object):
... def bar(self, blah):
... print self, blah
...
>>> Foo.bar
<unbound method Foo.bar>
>>> Foo.bar(None, 2)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unbound method bar() must be called with Foo instance as first argument (got NoneType instance instead)
>>> Foo.bar(Foo(), 2)
<__main__.Foo object at 0x1f7d2d0> 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment