On 16/09/2023 11:33, Dom Grigonis wrote:

It works already with existing tools that will treat "nameof(a+b)" as a function call, which it is syntactically but not semantically, so renaming b to c will now produce the string "a+c". I think my IDE does offer to do this with variable names in strings and comments, but it produces so many false hits I don't enjoy using the feature.

So the functionality is bound to an editor and anyone using another editor would just see a weird string?
After several similar editor features things could get very confusing.

No, the opposite. By "works now", I meant to say that if a nameof() pseudo-function were added to the Python language, existing tools would not have to change, because they would treat it as a call. This does scratch an itch (in renaming) by removing the need to guess or ask the human whether a given string is a variable name.

I'm not convinced this feature is widely useful.

So what is the general procedure for determining it?

1. Compelling use cases here or (better) on the Dicourse counterpart
   <https://discuss.python.org/c/ideas/6>.
2. Community and core dev acclamation as a Good Thing.
3. Willigness to implement and maintain.

--

Jeff Allen
_______________________________________________
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/LUDUIZB7VEYPUQWIT2YGYV3ECKMZ2V4J/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to