Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:

Accepting a slice directly in the range constructor is ambiguous. What to do if 
start or stop are negative or None? What if stop is less than start? You need 
to specify a sequence length to handle these cases.

Maybe the following expressions work for you:

   range(length)[s]

or

   range(*s.indices(length))

But other users may need different behavior (if they want convert slice(-20, 
-10) to range(-20, -10)). There is no general solution which would work for 
all, you have to code what you need.

----------
nosy: +rhettinger, serhiy.storchaka

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue46312>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to