Why does __init__ not get called?

infidel saint.infidel at gmail.com
Tue Aug 9 14:54:33 EDT 2005


I think you have to call type.__new__ like this:

    def __new__(cls, year, month, day, *args, **kw):
        print "new called"
        try:
            return _datetime.__new__(cls, year, month, day, *args,
**kw)
        except ValueError:
            return type.__new__(cls, ...)

Are you sure you can specify arbitrary arguments to the __new__ method?
 I thought they had to be the class object, the tuple of bases, and the
dictionary of names.




More information about the Python-list mailing list