30 Aug
2019
30 Aug
'19
5:28 a.m.
Steven D'Aprano wrote:
I don't think that stpasha@gmail.com means that the user literally assigns to locals() themselves. I read his proposal as having the compiler automatical mangle the names in some way, similar to name mangling inside classes.
Yes, but at some point you have to define a function to handle your string prefix. If it's at the module level then it's no problem, because you can do something like globals()["~f"] = lambda: ... But you can't do that for locals. So mangling to something unspellable would effectively preclude having string prefixes local to a function. -- Greg