[ python-Bugs-1686597 ] descrintro: error describing __new__ behavior

SourceForge.net noreply at sourceforge.net
Tue Apr 3 23:47:53 CEST 2007


Bugs item #1686597, was opened at 2007-03-23 03:47
Message generated for change (Comment added) made by bediviere
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1686597&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Documentation
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Gabriel Genellina (gagenellina)
Assigned to: Nobody/Anonymous (nobody)
Summary: descrintro: error describing __new__ behavior

Initial Comment:
descrintro (http://www.python.org/download/releases/2.2.3/descrintro/#__new__) linked from http://www.python.org/doc/newstyle/ still says:

"__new__ must return an object. [...] If you return an object of a different class, its __init__ method will be called."

But since Revision 26220 - Modified Sat Apr 6 01:05:01 2002 UTC (4 years, 11 months ago) by gvanrossum:

"Changed new-style class instantiation so that when C's __new__ method returns something that's not a C instance, its __init__ is not called.  [SF bug #537450]"

That is, exactly the opposite as said on descrintro. The documentation for __new__ in the Reference manual, section 3.4.1, is correct and says: "If __new__() does not return an instance of cls, then the new instance's __init__() method will not be invoked."

Note that the modified behavior was already present on version 2.2.3 (and later) so updating the document currently at /download/releases/2.2.3/ would be fine.



----------------------------------------------------------------------

Comment By: Steven Bethard (bediviere)
Date: 2007-04-03 15:47

Message:
Logged In: YES 
user_id=945502
Originator: NO

Note that this is correct in the documentation:
http://docs.python.org/ref/customization.html

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1686597&group_id=5470


More information about the Python-bugs-list mailing list