Steven D'Aprano wrote:
> I'm not aware of many refactoring tools for Python at all, [...] I don't know 
> how well IDEs like VisualStudio and PyCharm do refactoring.

This help me to understand your point of view.

But if I consider your proposition, it's evident that a simple comment `# 
IDE:refactor` would not be enough for IDE. Because a string is full of words 
and several of them could matchs the symbols of your code; by the way, the IDE 
would not be able to delimitate expression. So you would have to put redondant 
information into your comment, and redundancy is not cool for the user; if the 
shortcut `f"{foo=}"` has been introduced in 3.8, that's to avoid "to repeat 
yourself" (word taken from feature author).

By the way, there is (as far as I know) no comment standardisation in Python, 
they are specific to the tools which use them. See how many docstring standard 
we have; Both Pycharm and Black have their own comment directive to toggle 
formatting on/off; when mypy and flake8 find an issue in your code, you have to 
put # type: ignore # noqa… How could an approach using comment be promising?

And as you can see in other responses to your post, when the Python language 
introduce a feature, IDEs adapt to fully support it. That's the case for 
f-string where refactoring, linting, type-checking, reformatting, etc. are 
handled inside. This is the difference between a literal string and a 
"not-evaluated" string.
_______________________________________________
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/J3RH4IMECCIWI7GQ65G6OX6EGNJ6JTRC/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to