Message249605
Issue #24912 showed that the interpreter has historically assumed that all instances of non-heap types are immutable when it comes to preventing __class__ reassignment, and changing this assumption caused problems with genuinely immutable types that use implicit instance caching (like string interning and the small integrer cache).
More generally, whether or not type instances are mutable or not has been defined somewhat informally - decimal.Decimal instances, for example, are nominally immutable, but this immutability is only by convention, rather than enforced by the interpreter.
It may be desirable to be able to explicitly declare instances of a type as mutable or immutable (both from Python and from C), rather than having that property be inferred from other characteristics in a situational way. |
|
Date |
User |
Action |
Args |
2015-09-03 06:08:03 | ncoghlan | set | recipients:
+ ncoghlan, njs |
2015-09-03 06:08:03 | ncoghlan | set | messageid: <1441260483.41.0.785006760825.issue24991@psf.upfronthosting.co.za> |
2015-09-03 06:08:03 | ncoghlan | link | issue24991 messages |
2015-09-03 06:08:02 | ncoghlan | create | |
|