On Mon, Aug 24, 2020 at 12:43 AM Christopher Barker <python...@gmail.com> wrote:
> Why not allow slice syntax as an expression everywhere? Everywhere I’ve > tried, it’s a syntax error now, but is there any technical reason that it > couldn’t be used pretty much anywhere? > How often do you do this? >>> class Slice: ... def __getitem__(self, o): ... return o >>> I = Slice() >>> print(I[1:100:3], I[999:888:-10]) slice(1, 100, 3) slice(999, 888, -10) Currently, it takes three extra characters to get a "slice anywhere." My answer is actually "more than never" since I actually use pandas.IndexSlice and numpy.s_ occasionally, both of which are the same as this (but as shown, no need to install/import either to get the functionality). But it's not "all the time" either. -- The dead increasingly dominate and strangle both the living and the not-yet born. Vampiric capital and undead corporate persons abuse the lives and control the thoughts of homo faber. Ideas, once born, become abortifacients against new conceptions.
_______________________________________________ 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/5JFEID6MHCHYKHEPO3YILUA3XYYN3TB7/ Code of Conduct: http://python.org/psf/codeofconduct/