Message162479
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. |
|
Date |
User |
Action |
Args |
2012-06-07 17:16:56 | mloskot | set | recipients:
+ mloskot, georg.brandl, cjw296, benjamin.peterson, eric.araujo |
2012-06-07 17:16:55 | mloskot | set | messageid: <1339089415.96.0.0474727789745.issue4442@psf.upfronthosting.co.za> |
2012-06-07 17:16:55 | mloskot | link | issue4442 messages |
2012-06-07 17:16:54 | mloskot | create | |
|