I\'d like to be able to do this:
class A(object):
@staticandinstancemethod
def B(self=None, x, y):
print self is None and \"static\" or \"ins
Since you'd like the static method case to be used to create a new class anyway, you'd best just make it a normal method and call it at the end of the __init__
method.
Or, if you don't want that, create a separate factory function outside the class that will instantiate a new, empty object, and call the desired method on it.
There probably are ways of making exactly what you are asking for, but they will wander through the inner mechanisms of Python, be confusing, incompatible across python 2.x and 3.x - and I can't see a real need for it.