Mateusz Loskot <mate...@loskot.net> added the comment:

Is this report about documenting of the concept of immutable types in Python in 
general or regarding existing built-in types, like datetime.datetime?

Generally, the concept of immutable type with relation to tp_new is mentioned 
(sneaked) here:

1) http://docs.python.org/release/3.2.2/c-api/typeobj.html

"A good rule of thumb is that for immutable types, all initialization should 
take place in tp_new, while for mutable types, most initialization should be 
deferred to tp_init."

2) http://www.python.org/dev/peps/pep-0253/

Note that for immutable object types, the initialization
cannot be done by the tp_init() slot: this would provide the Python 
user with a way to change the initialization.  Therefore, immutable
objects typically have an empty tp_init() implementation and do
all their initialization in their tp_new() slot.

IMHO, it deserves a dedicated section/chapter in the docs.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue4442>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to