Message162479
| Author |
mloskot |
| Recipients |
benjamin.peterson, cjw296, eric.araujo, georg.brandl, mloskot |
| Date |
2012年06月07日.17:16:54 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1339089415.96.0.0474727789745.issue4442@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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. |
|