Guido van Rossum wrote:
> Honestly I think it's fine the way you have implemented it -- since there is 
> a difference between a[1] and a[1,], a[*t] where len(t) == 1 has to make a 
> choice, and it's fine if this always passes a tuple.

Yup, I agree. Not only because it feels more intuitive to me (which is probably 
why I thoughtlessly implemented the parser this way before Stefano pointed out 
to me that it contradicted the PEP), but also because it's much simpler to 
reason about and understand. We don't have to worry about the type of the index 
varying at runtime based on the length of the unpacked args (empty tuple vs 
single object vs two-or-more-element tuple). I'm pretty sure that's a big win 
for static analysis, and I *know* it's a big win for simplifying the 
implementation.

The "rule" for this is simple. If there's a star-unpacking in the positional 
arguments, it will always pass a tuple, regardless of the resulting length.

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

Reply via email to