On Sun, May 1, 2022 at 10:35 AM Ethan Furman <et...@stoneleaf.us> wrote:

> On 5/1/22 00:21, Christopher Barker wrote:
>  > On Sat, Apr 30, 2022 at 2:17 PM Pablo Alcain wrote:
>
>
>  >> It shows that out of 20k analyzed classes in the selected libraries
> (including black,
>  >> pandas, numpy, etc), ~17% of them could benefit from the usage of
> auto-assign syntax.
>  >
>  > I only read English, and haven't studied the coe, so I don't know how
> that works, but
>  > assuming it's accurately testing for the simple cases that
> auto-assigning could work for;
>  >
>  > That's not that much actually --  for approx every six-parameter
> function, one of them
>  > could be auto-assigned.or for every six functions, one could make good
> use of auto-
>  > assignment (and maybe be a dataclass?)
>
> I think you place too much emphasis on dataclasses -- none of my projects
> use them, nor could they.
>
> Going through a one of my smaller projects, this is what I found:
>
> - number of `__init__`s: 11
> - number of total params (not counting self): 25
> - number of those params assigned as-is: 19
> - number of `__init__`s where all are assigned as-is: 6
> - number of non-`__init__`s where this would useful: 0
>
>
>  > And I'm not trying to be a Negative Nelly here -- I honestly don't
> know, I actually
>  > expected it to be higher than 17% -- but in any case, I think it should
> be higher than
>  > 17% to make it worth a syntax addition.
>
> 17% is a massive amount of code.
>
>  > But pandas and numpy may not be the least bit representative [...]?
>
> This would not be the first time Python was improved to help the
> scientific community.
>
> My own thoughts about the proposal:  It seems interesting, and assigning
> as-is arguments is a chore -- but I'm not sure
> using up a token to help only one method per class is a good trade.
>

Yes, I agree that the cost/benefit should be analyzed. For what it's worth,
the choice of the `@` was because of two different reasons: first, because
we were inspired by Ruby's syntax (later on learned that CoffeeScript and
Crystal had already taken the approach we are proposing) and because the
`@` token is already used as an infix for `__matmul__` (
https://peps.python.org/pep-0465/). I believe it's the only usage that it
has, so it probably won't be that confusing to give it this new semantic as
well. All of this, I believe, mitigate the "using up a token", but it's not
enough to make it a clear decision, so I 100% agree with your concern.



>
> --
> ~Ethan~
> _______________________________________________
> 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/2GR5G67IKJZDSFU4QYJQF7R4BCZUZPMJ/
> Code of Conduct: http://python.org/psf/codeofconduct/
>
_______________________________________________
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/V4TF6WRERLQBOQ72BGWHYAXCYX6MCT6J/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to