Let's say you do this or any of the variants suggested... What does this do?
a = {"foo": 1}
b = {}
with a:
with b:
foo = 0
On Fri, Jul 26, 2019 at 3:20 AM Batuhan Taskaya <[email protected]>
wrote:
> I am proposing namespace context managers with implementing `__enter__`
> and `__exit__` on dict objects. It would make closures possible in python
> with a pythonic syntax.
>
> a = 4
> namespace = {}
>
> with namespace:
> a = 3
>
> assert a == 4
> assert namespace["a"] == 3
> _______________________________________________
> Python-ideas mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
> https://mail.python.org/mailman3/lists/python-ideas.python.org/
> Message archived at
> https://mail.python.org/archives/list/[email protected]/message/TAVHEKDZVYKJUGZKWSVZVAOGBPLZVKQG/
> Code of Conduct: http://python.org/psf/codeofconduct/
>
--
CALVIN SPEALMAN
SENIOR QUALITY ENGINEER
[email protected] M: +1.336.210.5107
[image: https://red.ht/sig] <https://red.ht/sig>
TRIED. TESTED. TRUSTED. <https://redhat.com/trusted>
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/WIXNCWAEKSOUP6IY7CPCY6TOUJJSTDOP/
Code of Conduct: http://python.org/psf/codeofconduct/