This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author r.david.murray
Recipients alex, daniel.urban, pitrou, r.david.murray, rhettinger
Date 2011-02-23.18:39:15
SpamBayes Score 3.7451305e-06
Marked as misclassified No
Message-id <1298486356.35.0.488802588711.issue11297@psf.upfronthosting.co.za>
In-reply-to
Content
Yes, that's part of what I find more intuitive about it.  I think of the chainmap as a stack.  Perhaps if I had a different application (I would use it for either configuration or namespace management) I'd want a different API, but for those two the stack approach seems most natural to me.

In particular, since only the top dict can be updated, it seems most natural to pop it off the top of the stack in order to modify the next one down (and then push it back, if desired).  If instead the way to modify the next one down is to do parents, then I'm mutating the chainmap I just did the parents call on, but I'm not referencing that object, I'm referencing the one I got back from the parents call.  It just seems more natural that the mutation operations should be carried out via a single chainmap object by using pop and push rather than effectively modifying (potentially multiple) chainmap objects by manipulating other chainmap objects.  (Yes, I realize that it is really the underlying dicts that are being modified, but conceptually I'm thinking of the chainmap as a single data structure).
History
Date User Action Args
2011-02-23 18:39:16r.david.murraysetrecipients: + r.david.murray, rhettinger, pitrou, alex, daniel.urban
2011-02-23 18:39:16r.david.murraysetmessageid: <1298486356.35.0.488802588711.issue11297@psf.upfronthosting.co.za>
2011-02-23 18:39:15r.david.murraylinkissue11297 messages
2011-02-23 18:39:15r.david.murraycreate