[Python-ideas] ChainMap as a context manager

Nick Coghlan ncoghlan at gmail.com
Mon Aug 8 06:13:44 CEST 2011

On Mon, Aug 8, 2011 at 2:11 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> @contextmanager
> def scope(chain=None):
>    if scope is None:
>        yield ChainMap({})
>    else:
>        yield chain.new_child()

s/scope/chain/ on the first line of the function body.


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-ideas mailing list