[Python-ideas] str(slice(10)) should return "slice(10)"

Ivan Levkivskyi levkivskyi at gmail.com
Sat Nov 12 14:41:24 EST 2016


On 12 November 2016 at 20:27, David Mertz <mertz at gnosis.cx> wrote:

> I thought of the use of `.__getitem__()` in metaclasses in the typing
> module.  I feel like this use is more natural and more useful than that.
> Should we someday need a slice generic type for PEP 484, the spelling would
> naturally be `Slice[T]` instead, in my mind.  But `slice[1:10,2]` should be
> a constructor for a concrete slice object.
>

Slice[T] vs slice[::-1] is coherent with what we have now for List[T] vs
list, etc.

--
Ivan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20161112/6cd32b9f/attachment.html>


More information about the Python-ideas mailing list