On Mon, Aug 24, 2020 at 12:23 PM Jonathan Fine <[email protected]> wrote:
> Christopher wrote: Why not allow slice syntax as an expression everywhere? > > In reply, Todd wrote: That is a very different discussion, and not > directly related to keyword indexes. Would it be possible to start a new > email thread to discuss it? > > I think they are closely related matters, at least in terms of > implementation. For details see rest of this message. I hope this helps our > understanding, even if it shows difficulties lying ahead. > > My non-expert understanding is that if > >>> d[a=1:2:3] > is allowed by making a minimal change to Python's abstract grammar, then > >>> f(a=1:2:3) > will also be allowed. (Extra work would be required to forbid it.) > Why would that be the case? d[1:3] is allowed but d(1:3) isn't. The interpreter replaces "1:3" with "slice(1, 3)" behind-the-scenes.
_______________________________________________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/OZUR6QTUWGP5S6MAABKLW5MEPGL3CU7B/ Code of Conduct: http://python.org/psf/codeofconduct/
