Re: Python 2.6 Deprecation Warnings with __new__ — Can someone explain why?
Terry Reedy
tjreedy at udel.edu
Fri Oct 23 03:04:41 EDT 2009
Consider this:
def blackhole(*args, **kwds): pass
The fact that it accept args that it ignores could be considered
misleading or even a bug. Now modify it to do something useful, like
return a new, naked, immutable object that is the same for every call
except for identity, and which still totally ignores the args as
irrelavant. Call it object.__new__. It is just as misleading, if not
more so.
In 3.x, the mistake has been fixed.
>>> object(1)
Traceback (most recent call last):
File "<pyshell#9>", line 1, in <module>
object(1)
TypeError: object.__new__() takes no parameters
Terry Jan Reedy
More information about the Python-list
mailing list