On Mon, Aug 24, 2020 at 12:43 AM Christopher Barker <pythonchb@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.