#!/usr/bin/python class XClass(type): def default(cls): obj = cls(0) return obj def abc(cls): print "abc" cls.run(cls(2), 2) class X(object): __metaclass__ = XClass def __init__(self, x): self.x = x def run(self, x): print "run" def foo(self): type(self).abc() class Y(X): plop = 2 def __plop__(self, abc): pass def __new__(self, x, y): print "new" print type(self) def __init__(self, x, y): print "init" print type(self) help(Y) class Z(Y): def __init__(self, x, y): pass a = Y(2, 3) b = Y(1, 2) if a == Y: print "yep" Z(2, 3) #X.__init__(X(2), 2) #y = Y(1, 2) #y.run(2) #y.run(Y(2,1), 2)