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

2011-02-25 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: Minor doc issue: s/__builtin__/builtins/ -- nosy: +eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11297 ___

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

2011-02-25 Thread Raymond Hettinger
Raymond Hettinger rhettin...@users.sourceforge.net 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

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

2011-02-25 Thread Raymond Hettinger
Raymond Hettinger rhettin...@users.sourceforge.net 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

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

2011-02-25 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: Raymond: Sorry I was imprecise. I was referring specifically to “import __builtin__” in collections.rst. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11297

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

2011-02-23 Thread Raymond Hettinger
New submission from Raymond Hettinger rhettin...@users.sourceforge.net: 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

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

2011-02-23 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr 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

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

2011-02-23 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: (too specialized, sorry) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11297 ___ ___

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

2011-02-23 Thread Daniel Urban
Changes by Daniel Urban urban.dani...@gmail.com: -- nosy: +durban ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11297 ___ ___ Python-bugs-list

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

2011-02-23 Thread R. David Murray
R. David Murray rdmur...@bitdance.com 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

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

2011-02-23 Thread Alex
Alex alex.gay...@gmail.com 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 rep...@bugs.python.org

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

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

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

2011-02-23 Thread Raymond Hettinger
Raymond Hettinger rhettin...@users.sourceforge.net 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