> > > This might be a silly idea but, would it be a good idea to have > > ...[a:b:c] return a range(a, b, c)? >
If a 'thunderscore' is acceptable: import itertools class _ranger: @classmethod def __getitem__(self, key: slice): if isinstance(key, slice): if key.stop is None: return itertools.count(key.start, key.step or 1) return range(key.start, key.stop, key.step or 1) return range(key) ___ = _ranger() Trying to write it brings out lots of questions like what would [:y] do, or [:], [::z], etc. Only [x], [x:y], [x:], [x::z], [x:y:z] seem to make sense.
_______________________________________________ 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/WARMRS7GMQHYEBGR5FTBKHW436DWRWW6/ Code of Conduct: http://python.org/psf/codeofconduct/