Created
January 31, 2014 10:11
-
-
Save iolloyd/8729502 to your computer and use it in GitHub Desktop.
An example of how to make a class callable as an instance in python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo: | |
def __call__(self): | |
print 'you called me' | |
caller = Foo() | |
caller() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment