[issue11297] Make ChainMap() public in the collections module.

2011-02-25 Thread Éric Araujo
Éric Araujo added the comment: Raymond: Sorry I was imprecise. I was referring specifically to “import __builtin__” in collections.rst. -- ___ Python tracker ___ _

[issue11297] Make ChainMap() public in the collections module.

2011-02-25 Thread Raymond Hettinger
Raymond Hettinger added the comment: I was thinking of adding a recipes section to show how to extend or override the class: class DjangoContext(ChainMap): def push(self): self.maps.insert(0, {}) def pop(self): self.maps.pop(0) class NestedScope(ChainMap): 'Mutating met

[issue11297] Make ChainMap() public in the collections module.

2011-02-25 Thread Raymond Hettinger
Raymond Hettinger added the comment: Antoine. Thanks. I put in a paragraph re-emphasizing that ChainMap is a view and that changes in the underlying mappings get reflected in the ChainMap. Also, the first sentence says that ChainMap groups multiple dicts or other mappings. So, any mapping

[issue11297] Make ChainMap() public in the collections module.

2011-02-25 Thread Éric Araujo
Éric Araujo added the comment: Minor doc issue: s/__builtin__/builtins/ -- nosy: +eric.araujo ___ Python tracker ___ ___ Python-bugs-

[issue11297] Make ChainMap() public in the collections module.

2011-02-23 Thread Raymond Hettinger
Raymond Hettinger added the comment: FWIW, the new_child() and parents() part of the API was modeled after contexts in ANLTR where they are needed to overcome the limitations of Django's push/pop style which precludes a context from having multiple, independent children at the same time. The

[issue11297] Make ChainMap() public in the collections module.

2011-02-23 Thread R. David Murray
R. David Murray 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 ap

[issue11297] Make ChainMap() public in the collections module.

2011-02-23 Thread Alex
Alex added the comment: An important distinction with Django's push/pop is that they mutate the Context (ChainMap) rather than return a fresh instance. -- nosy: +alex ___ Python tracker __

[issue11297] Make ChainMap() public in the collections module.

2011-02-23 Thread R. David Murray
R. David Murray added the comment: I don't think that new_child and parents are too specialized at all, indeed they are essential to one of the primary use cases for the construct. I find Django's push and pop much more intuitive than new_child and parents, however, and would prefer those me

[issue11297] Make ChainMap() public in the collections module.

2011-02-23 Thread Daniel Urban
Changes by Daniel Urban : -- nosy: +durban ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.o

[issue11297] Make ChainMap() public in the collections module.

2011-02-23 Thread Antoine Pitrou
Antoine Pitrou added the comment: ("too specialized", sorry) -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue11297] Make ChainMap() public in the collections module.

2011-02-23 Thread Antoine Pitrou
Antoine Pitrou added the comment: This is nice, but IMO there is some information lacking, e.g.: - when an underlying mapping is mutated, does the ChainMap get updated too? - does it work with arbitrary mappings or only with dicts or dicts subclasses? I think new_child() isn't very useful. It s

[issue11297] Make ChainMap() public in the collections module.

2011-02-23 Thread Raymond Hettinger
New submission from Raymond Hettinger : Attaching a documentation patch. -- assignee: rhettinger files: chainmap.diff keywords: patch messages: 129161 nosy: rhettinger priority: low severity: normal status: open title: Make ChainMap() public in the collections module. type: feature reque