Message402468
On 22.09.2021 21:02, Raymond Hettinger wrote:
>> The language specification says that the dicts maintain insertion
>> order, but the wording implies that this only to explicit
>> dictionaries, not instance attribute or other namespace dicts.
>
> That is a quite liberal reading of the spec. I would object to making instance and namespace dicts behave differently. That would be a behavior regression and we would forever have to wrestle with the difference.
I agree. Keeping the insertion order is essential for many common
use cases, including those where a class or instance dict is used,
e.g. namespaces used for data records, data caches, field
definitions in data records, etc. (and yes, those often can be
dynamically extended as well :-)).
I think for the case you mention, a documentation patch would be
better and more helpful for the programmers. Point them to slots
and the sharing problem should go away in most cases :-) |
|
Date |
User |
Action |
Args |
2021-09-22 19:46:34 | lemburg | set | recipients:
+ lemburg, rhettinger, methane, Mark.Shannon, serhiy.storchaka |
2021-09-22 19:46:34 | lemburg | link | issue40116 messages |
2021-09-22 19:46:34 | lemburg | create | |
|