[PEAK] DeprecationWarning under python 2.6

Sergey Schetinin maluke at gmail.com
Tue Jul 14 18:39:49 EDT 2009

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.

More information about the PEAK mailing list