method that can be called from a class and also from an instance
glicerinu at gmail.com
Thu Nov 22 16:14:29 CET 2012
I want to create a method within a class that is able to accept either a class or an instance.
# param can be MyClass (cls) or an instance of MyClass (self)
so I can do something like:
instance = MyClass()
I guess the way to go is implementing a custom decorator (@magic_decorator in my example), but, how can I know if the method has been called from the class o from an instance?
Thank you very much!!
More information about the Python-list