On 31/08/20 4:11 pm, Guido van Rossum wrote:
Can I write a.__getitem__((1, 2), k=3) and the function will see (i, j, k) == (1, 2, 3)?
Yes.
Okay, and if I write a.__getitem__((1, 3), k=2) will the function see the same thing?
No, it will see (i, j, k) == (1, 3, 2). It's the same as if you were calling an ordinary function and passing the tuple using *: >>> def f(i, j, k): ... print(i, j, k) ... >>> f(*(1, 2), k = 3) 1 2 3 >>> f(*(1, 3), k = 2) 1 3 2
I've got the feeling you're pranking me here, and I'm falling for it hook, line and sinker.
No, it was a serious suggestion. But if you don't like it, that's fine. -- Greg _______________________________________________ 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/CSFQTYIKJLZZ7MVSWSJBE33P6Z5KIY2X/ Code of Conduct: http://python.org/psf/codeofconduct/