On Wed, Apr 25, 2018 at 2:57 AM, Steven D'Aprano <st...@pearwood.info> wrote: > On Wed, Apr 25, 2018 at 02:42:08AM +1000, Chris Angelico wrote: > >> > from math import * >> > process(arg, (pi = 1), pi+1) # allowed > > >> That's not allowed at local scope (at least, it's not allowed at >> function scope - is there any other "local scope" at which it is >> allowed?). > > Of course: local just means the current scope, wherever you happen to > be. Inside a function, local is the current function scope. Inside a > class body, local is the class body scope. At the top level of the > module, local means the module scope (and locals() returns the same dict > as globals()). > > If Yury means for this "cannot mask existing variables" to only operate > inside functions, that means that you can mask existing variables if you > use assignment expressions in class bodies or top-level module code.
I don't have a quote for it, but I was under the impression that this shielding was indeed function-scope-only. Actually, now that I think about it, I'm not sure whether Yuri's plan for assignment expressions even included module scope. ChrisA _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com