On Mon, Aug 20, 2018 at 7:21 AM, Steven D'Aprano <st...@pearwood.info> wrote:
> * Introducing a warning makes it clear that this is not a de facto > language standard, but a mere implementation detail subject to > change if somebody comes up with a better optimization for locals. > defacto standards are sub-optimum -- the docs say "may not" -- that seems really sketchy to me. Even if there is no change to the implementation of cPython, I'd like to see the behavior clearly defined -- if I pass a object returned by "locals()" to a function, and that function modifies that object -- will, or will not, the local namespace be altered? Saying it "may" be altered is kind of crazy! Does that mean the same code will have a different effect if run in two different (compliant) implementations of Python? That sure seems like a bad idea... > more so, I do not believe that anyone will rely or use such a feature. > well, this thread exists because someone wanted to do something like that -- i.e. manipulate the calling namespace from within a function. I suggested that passing locals() in might work -- it didn't work (in cPython), but if it HAD worked in whatever implementation the OP is using, then, yes, someone would now be relying on that feature. -CHB -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception chris.bar...@noaa.gov
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/