On 2020-08-06 14:16, Stestagg wrote:
I was following you right up till this bit:


    By the way, as previously noted
         d[1, 2]
         d[(1, 2)]
    are at present equivalent. However, in the new syntax
         d[1, 2, a=3]
         d[(1, 2), a=3]
    are not equivalent. (The first has three arguments, the second two,
    the first of which is a tuple.)

In the "New syntax", wouldn't these examples map to:

d[1, 2, a=3]  =>  d.__getitem__((1, 2), a=3)
and
d[(1, 2), a=3]  =>  d.__getitem__((1, 2), a=3)

Not quite. The second should be:

d[(1, 2), a=3]  =>  d.__getitem__(((1, 2),), a=3)

I.e. My understanding was that the existing conversion of all positional parameters in a subscript would be packed into a tuple (strictly for consistency with legacy behaviour) while any keywords would be passed as kwargs?

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

Reply via email to