Re: DeprecationWarning under python 2.6

Sergey Schetinin <[email protected]> Wed, 15 Jul 2009 01:39:49 +0300
Newsgroups gmane.comp.python.peak
Message-ID <[email protected]>
A more generic solution would be to add a class to be used as
baseclass for all __new__-redefining classes. It would belong to
DecoratorTools I guess. Something like:

class redefines_new(object):
   def __new__(cls, *args, **kw):
        # Work around for python 2.6 DeprecationWarning
        return object.__new__(cls)

Then, given that all classes that redefine __new__ will inherit from
it, refines_new.__new__ will be the last in mro, and the super call
passing all the arguments will work fine.