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

> 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.
>

Is it unreasonable to instead suggest generalizing the assignment target
for parameters? For example, if parameter assignment happened left to
right, and allowed more than just variables, then one could do:

def __init__(self, self.x, self.y): pass

Python 2 had non-variable parameters (but not attributes, just unpacking:
def foo((x, y)): pass), but it was removed in Python 3, because of issues
with introspection (among other, perhaps less significant, issues):
https://peps.python.org/pep-3113/

Perhaps now that positional-only parameters exist, and the introspection
APIs have evolved over time, there is a way to work this into the
introspection APIs sensibly.

(a "@foo" parameter does not have this problem, because it's just a
parameter named `foo` with some extra stuff.)

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

Reply via email to