[Python-ideas] ChainMap as a context manager

Mike Graham mikegraham at gmail.com
Sun Aug 7 17:02:15 CEST 2011

On Sun, Aug 7, 2011 at 10:50 AM, dag.odenhall at gmail.com
<dag.odenhall at gmail.com> wrote:
> How about adding the context manager protocol to collections.ChainMap,
> as an in-place combination of new_child() and parents()? The effect
> would simulate lexical scope using the with-statement.
> Trivial to do customly but always nice when builtin or stdlib types
> support the context manager protocol. :)

I don't understand the utility of such a thing. Can you post a use
case or two to make it clearer to people like me?


More information about the Python-ideas mailing list