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

אלעזר elazarg at gmail.com
Sat Nov 12 14:20:18 EST 2016


On Sat, Nov 12, 2016 at 9:10 PM David Mertz <mertz at gnosis.cx> wrote:

>
> dfmi.loc[slice[:,:,['C1','C3']], slice[:,'foo']]
>
>
> I like the change proposed to `str(slice(10))` also... and it would be way
> better if `slice[:10]` were actual "syntax."  In fact, in that case it
> could even be the repr().
>
>
Indexing operator for classes already has a meaning, for generic types. It
is a possibility that slice will become a generic type (see here:
https://github.com/python/mypy/issues/2410#issuecomment-258898836) and this
syntax will make it either impossible or require Slice[] to be different
from slice[] in a potentially confusing way.

Elazar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20161112/678ac967/attachment.html>


More information about the Python-ideas mailing list