While reading up about some python module I encountered this decorator class:
# this decorator lets me use methods as both static and instance methods
class omni
omnimethod does what it says in the comment; it will let you call some_function as either a 'static function' on a class or as a function on an instance of the class. @property is a standard decorator (see the python docs) that exposes a function in a way that makes it look like a simple instance variable.
class B:
@omnimethod
def test(self):
print 1
@property
def prop(self):
return 2
>>> b = B()
>>> b.test()
1
>>> B.test()
1
>>> b.prop
2