[Python-ideas] Re: f-string code formatting

2020-09-20 Thread Steven D'Aprano
On Fri, Sep 18, 2020 at 12:32:32PM -0400, Wes Turner wrote: > Is there a list of supported preprocessor directives or compiler directives > supported by CPython and other tools? I expect that most tools will have their own list. Python doesn't really have directives other than `from __future__ im

[Python-ideas] Re: f-string code formatting

2020-09-18 Thread Wes Turner
Is there a list of supported preprocessor directives or compiler directives supported by CPython and other tools? - from __future__ import ... - __debug__ https://docs.python.org/3/library/constants.html#__debug__ - encoding https://www.python.org/dev/peps/pep-0263/#defining-the-encoding # c

[Python-ideas] Re: f-string code formatting

2020-09-18 Thread Joseph Perez
> As Ricky and Wes have pointed out, IDE refactoring tools are already able to > look inside not just f-strings but regular strings too. Ricky has written the opposite : "As far as I know, none of these tools know how to do the renaming of the FIRST bar to bar_new:", and i can confirm > If yo

[Python-ideas] Re: f-string code formatting

2020-09-18 Thread Steven D'Aprano
On Fri, Sep 18, 2020 at 08:05:27AM -, Joseph Perez wrote: > 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

[Python-ideas] Re: f-string code formatting

2020-09-18 Thread Joseph Perez
Ricky Teachey wrote: > But if you really want it or need it in a situation where find and replace > isn't a great option The example i've given is a good example where find and replace isn't a great option. In fact, you don't want to use find and replace to change a function parameter, because

[Python-ideas] Re: f-string code formatting

2020-09-18 Thread Joseph Perez
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:refac

[Python-ideas] Re: f-string code formatting

2020-09-17 Thread Ricky Teachey
On Thu, Sep 17, 2020 at 9:32 PM Wes Turner wrote: > There are a number of refactoring tools for Python. > From https://github.com/beat-no/roper#alternatives : > > ... > Another: https://sourcery.ai/ On Thu, Sep 17, 2020 at 8:27 PM Steven D'Aprano wrote: > >> On Thu, Sep 17, 2020 at 11:47:03PM

[Python-ideas] Re: f-string code formatting

2020-09-17 Thread Wes Turner
There are a number of refactoring tools for Python. >From https://github.com/beat-no/roper#alternatives : ```rst Alternatives IDEs * PyCharm - https://www.jetbrains.com/help/pycharm/refactoring-source-code.html Editor plugins -- * vim - https://github.com/python-rop

[Python-ideas] Re: f-string code formatting

2020-09-17 Thread Steven D'Aprano
On Thu, Sep 17, 2020 at 11:47:03PM -, Joseph Perez wrote: > Thus `f"{:a + b}" == "a + b"`. That can already be done by just *not* using a f-string. This looks like a case of "when the only tool you have is a hammer, everything looks like a nail". If you don't want a string literal to be ev