R. David Murray <rdmur...@bitdance.com> added the comment:

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).

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue11297>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to