On 2019-06-26 14:27, nate lust wrote:
This is the example I was talking about specifically:
https://github.com/natelust/CloakingVarWriteup/blob/master/examples.py#L76.
There are other possibilities as well, I would be happy to explain my
Ideas directly, I am not sure exactly everything Yanghao is saying as I
have not been able to follow it very closely.

I've been reading this discussion off and on, and just looked at your example. It only confirms what I've thought since the beginning: none of the examples or use cases described provide even remotely sufficient justification for changing the behavior of assignment to a bare name. They are light years away from being sufficient justification.

In the unlikely event that you want something that can track all the values that have been assigned to it, I just don't see any reason why you can't make that thing be an attribute of an object. Then the descriptor protocol already handles everything under discussion here. If you don't like typing you can name the object "x" so you just have to type "x.foo = 1". Adding descriptor-like behavior to bare names massively increases the potential confusion and, as far as I can see, the only "benefit" proposed is that you don't have to type a dot.

I'm frankly quite surprised that this discussion has gone on so long. I just can't see any benefit to any of the proposals that gets anywhere close to justifying the increased difficulty of reasoning about code where any assignment to a local variable can call arbitrary code under the hood.

--
Brendan Barnwell
"Do not follow where the path may lead. Go, instead, where there is no path, and leave a trail."
   --author unknown
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/SCOFYLLZR2DOOZOAOIQT3E6M2HDLGVDZ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to