Le Fri, 12 Jun 2009 22:37:17 +1000, Lie Ryan <lie.1...@gmail.com> s'exprima ainsi:
> >>> class Normal(object): > ... def __new__(cls, arg): > ... if arg: > ... return Special(arg) > ... else: > ... ret = super(Normal, cls).__new__(cls) > ... ret.__init__(arg) > ... return ret > ... def __init__(self, arg): > ... self.arg = arg > ... Forgot a question. You & I create and return a special object directly (above: "Special(arg)"). But the docs say we should use __new__ instead. Denis ------ la vita e estrany _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor