On Sun, Apr 19, 2020 at 5:46 PM Steven D'Aprano <st...@pearwood.info> wrote:
>
> On Sun, Apr 19, 2020 at 01:24:14AM +1000, Chris Angelico wrote:
>
> [...]
> > Alex referred to refactoring "text that looks like an expression", and
> > on that point, I absolutely agree with Steven here: there are MANY
> > places where "text that looks like an expression" can have vastly
> > different meanings in different contexts.
>
> [...]
> > So I think that the false parallel here IS a strike against the proposal.
>
> I don't deny it. I just hope people can understand that language design
> should not be "one strike and you're out". Sometimes compromises are
> needed.

Yes, exactly. One strike doesn't mean it's out, and with a proposal
like this, it's a matter of looking at a whole lot of imperfect
alternatives and seeing which tradeoffs we want to go with. (And
status quo is one such alternative, with tradeoffs of "names need to
be duplicated".)

> It would be good if we had something that was neither excessive verbose
> nor painfully terse, required nothing but ASCII, that was similar enough
> to dict unpacking to suggest a connection, but without being confusable
> to anything else even to newbies, was self-descriptive without needing
> much or any explanation, cured Covid-19, brought peace to the Middle
> East, ended poverty, and improved the level of political discourse on
> social media.
>
> But I fear we may have to relax the requirements somewhat :-)

Agreed. And not everyone will have the same preferences - the "nothing
but ASCII" option means more to some than to others, and peace in the
Middle East would be really nice but not if it means a 0.001%
performance hit in microbenchmarks. :)

> My requirements for this syntax are:
>
> - it's a form of dict unpacking, so it ought to use `**` rather than
>   overloading some other, unrelated, symbol like (say) `@` or `%`;
>
> - it ought to use a simple list of identifiers without needing extra
>   sigils or markers on each one, say:
>
>   `meta, dunder, private`
>
>   rather than
>
>   `:meta, :dunder, :private` or `meta=, dunder=, private=`

I'm actually fine with the "meta=, dunder=, private=" myself, but
that's because I'm mixing and matching so much.

> - it ought to be something "like" an expression, rather than a mode
>   that has to be turned on and then applies to the end of the function
>   call;
>
> - if it actually is an expression, that's a nice bonus, but it's
>   not essential;
>

Given that the existing keyword argument syntax isn't exactly an
expression already, I'm fine with it not being perfectly an
expression. We already use the equals sign to indicate the separation
between target and value, so it's fine IMO to use that as the
notation.

> - it ought to look Pythonic, which is subjective;
>
> - or at least not look like "line noise", which is still subjective
>   but it's probably easier to get agreement on what is ugly than on
>   what is beautiful :-)
>
> It is a lot to ask.
>
> If anyone else can think of an alternative, please do speak up!
>

Indeed. And this is why I think we need a PEP that has the
alternatives laid out with the various arguments for and against. If
someone thinks of an alternative that isn't listed, it can be added.

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

Reply via email to