[Python-Dev] __new__ deprecation
Guido van Rossum
guido at python.org
Wed Feb 13 23:47:53 CET 2008
More information about the Python-Dev mailing list
Wed Feb 13 23:47:53 CET 2008
- Previous message: [Python-Dev] __new__ deprecation
- Next message: [Python-Dev] 2.5.2 freeze upcoming
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
The message means just what it says. :-) There's no point in calling object.__new__() with more than a class parameter, and any code that did so was just dumping those args into a black hole. The only time when it makes sense for object.__new__() to ignore extra arguments is when it's not being overridden, but __init__ *is* being overridden -- then you have a completely default __new__ and the checking of constructor arguments is relegated to __init__. The purpose of all this is to catch the error in a call like object(42) which (again) passes an argument that is not used. This is often a symptom of a bug in your program. --Guido On Feb 13, 2008 12:19 PM, Jeroen Ruigrok van der Werven <asmodai at in-nomine.org> wrote: > -On [20080213 21:02], Guido van Rossum (guido at python.org) wrote: > >What __new__ deprecation warning? > > Yes, sorry, I realized after sending that it might be a bit obtuse. > > With 2.6: > > DeprecationWarning: object.__new__() takes no parameters > return object.__new__(cls, uri) > > -- > Jeroen Ruigrok van der Werven <asmodai(-at-)in-nomine.org> / asmodai > $B%$%'%k!<%s(B $B%i%&%U%m%C%/(B $B%t%!%s(B $B%G%k(B $B%&%'%k%t%'%s(B > http://www.in-nomine.org/ | http://www.rangaku.org/ > I am the impossibility... > -- --Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-Dev] __new__ deprecation
- Next message: [Python-Dev] 2.5.2 freeze upcoming
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list