[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

[Python-ideas] Re: Magic attribute for attribute names retrieving

2020-09-18 Thread Joseph Perez
> Dunder names are reserved for use by the Python interpreter. That's convenient, because my suggestion is to add a magic attribute into the Python specifications ;) It would be a `type` attribute, like `__mro__` or others. > So here we have `__attrs__` is not just a dunder attribute, but

[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 `#

[Python-ideas] f-string code formatting

2020-09-17 Thread Joseph Perez
Note: this suggestion should echo https://mail.python.org/archives/list/python-ideas@python.org/thread/UUFFAI3FZMQRVPDCUPZEOAZCRNXKWFDE/ but has a bigger scope and completely differs in the way to proceed. Currently, Python lacks a way to integrate code parts into string; when I say code, I

[Python-ideas] Re: Magic attribute for attribute names retrieving

2020-09-17 Thread Joseph Perez
Alex Hall wrote: > This sounds a lot like this suggestion to add a nameof function/operator: > https://mail.python.org/archives/list/python-ideas@python.org/thread/UUFFAI3... Indeed, it sounds like the `nameof` operator; I had not heard of this suggestion before your message. However, there is

[Python-ideas] Magic attribute for attribute names retrieving

2020-09-17 Thread Joseph Perez
A lot of libraries use string for attribute names to do some "dynamic" things. A typical example are SQLAlchemy [validators](https://docs.sqlalchemy.org/en/13/orm/mapped_attributes.html#simple-validators): ```python from sqlalchemy.orm import validates class EmailAddress(Base):

[Python-ideas] Re: Limit 'import as' syntax

2020-03-30 Thread Joseph Perez
As spotted by response, I did not mature enough my point to see that they could have a slight difference between both statements. This thread is no longer relevant. Thank you ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send

[Python-ideas] Re: Limit 'import as' syntax

2020-03-30 Thread Joseph Perez
You are right, I did not envisage the case where you could have name mangling between submodule and variable inside package __init__.py, which could lead to different behavior. So my statement is erroneous and this thread is no longer relevant. Thank you

[Python-ideas] Re: Limit 'import as' syntax

2020-03-30 Thread Joseph Perez
There is no other advantage than respect of the Zen of Python (and I don't know how much it counts). Maybe it can simplify interpreter code, but I don't know about it and I doubt it. With that, it could help newcomers to Python to choose between the two syntaxes. (And I've already experienced