Or perhaps more problematic what happens if only stride is specified? On Thu, Mar 18, 2021 at 6:09 PM Chris Angelico <[email protected]> wrote:
> On Fri, Mar 19, 2021 at 10:46 AM Cameron Simpson <[email protected]> wrote: > > > > I know that range(start,end,stride) will produce what I'd want from > > iter(slice(start,end,stride)), but wouldn't it be reasonable for a slice > > itself to be iterable? > > > > Yes, only one obvious way and all that, but inside eg __getitem__ it > > seems to me that: > > > > if isinstance(index, slice): > > for i in index: > > ... do stuff with i ... > > > > is the obvious thing to do. > > > > What if the start is positive and the end is negative? What values should > i get? > > ChrisA > _______________________________________________ > 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/O6ZF3UZIWTJFBGOYDXDZ7X4X7FA6DNHK/ > Code of Conduct: http://python.org/psf/codeofconduct/ >
_______________________________________________ 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/ZRAV5SGWHTLLRZF5KDA5244CPHHQY34F/ Code of Conduct: http://python.org/psf/codeofconduct/
