Re:PEP 572: Python assignment expressions has been accepted
by akvadrako on Tuesday July 03, 2018 @07:23AM
(#17449244)
I'm not sure exactly, but my point is that a program transformation can do it. However, no transformation can change an import to other operations while perserving semantics.
Re:PEP 572: Python assignment expressions has been accepted
by yorwba on Tuesday July 03, 2018 @07:47AM
(#17449346)
That only works at top-level scope, where locals() == globals(). Inside a function, changing the dict returned by locals() doesn't actually change the variable.
Just for fun, this seems to work: