On Mon, 20 Apr 2020 at 12:19, Eric V. Smith <eric@trueblade.com> wrote:
On 4/20/2020 7:00 AM, Steven D'Aprano wrote:
> On Mon, Apr 20, 2020 at 10:03:50AM +0200, M.-A. Lemburg wrote:
>> Guys, is it really worth saving a few hits on the auto-complete key
>> by adding even more mysterious twists to the existing Python function
>> call syntax ?
>> The current version already strikes me as way too complex.
>> It's by far the most complex piece of grammar we have in Python:
> (I think you pasted the typedarglist rules twice.)
> Now that Python is moving to a PEG parser, could it be simplified?
> Might we get sequence-unpacking parameters back again?
>      # Legal in Python 2, illegal in Python 3.
>      py> def func(a, (b, c), d):
>      ...     print a, b, c, d
>      ...
>      py> func(1, "ab", 3)
>      1 a b 3
> I know that was a feature that got removed only because it was hard to
> specify in the grammer, even though it was used by lots of people.

See PEP 3113, which doesn't mention parsing. My understanding is that it
was the introspection problem that drove this.

And on very rare occasions, I really miss this feature.

I migrated a lot of code to Python 3 recently and I really miss this feature in lambdas:

sorted(users, key=lambda u: (u[1].lower(), u[0]))

is IMO much uglier than

sorted(users, key=lambda (id, name): (name.lower(), id))