On Thu, 12 Mar 2020 at 16:57, Eric Wieser <[email protected]> wrote:
>
> It looks like actually this can be be built as a function today:
>
>     def move(name):
>         return inspect.currentframe().f_back.f_locals.pop(name)
>
> Which works as follows, but it feels awkward to pass variable names by 
> strings (and will confuse linters):
>
>     >>> for v in itertools.combinations([1, 2, 3], 1):
>     ...    print(id(move("v")))
>     1718903397008
>     1718903397008
>     1718903397008

I'm both impressed and horrified by this :-)

Paul
_______________________________________________
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/42KOI2RBK7PI4IAZZARAANKE5BIKL7KS/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to