Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Duncan Booth a écrit : > (snip) >> I think what you want for Bar is something more along the lines: > > (snip) > >> class Bar(Foo): >> def __new__(cls, a, b, c, *args): >> print 'Bar.__new__', len(args) >> target = cls > You don't use 'target' anywhere... > >> if not args: >> cls = Zoo >> obj = super(Bar, cls).__new__(cls, a, b, c, *args) >> if args: >> return obj >> >> obj.__init__(a, b, c, 7) > > IIRC, __new__ is supposed to return the newly created object - which you > are not doing here. > Yup. I committed that cardinal sin of checking the code and then tidying it up by hand but not checking the tidied version. :(
-- http://mail.python.org/mailman/listinfo/python-list