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

Guido van Rossum guido at python.org
Sun Nov 13 10:55:18 EST 2016


On Sat, Nov 12, 2016 at 7:35 PM, Alexander Heger <python at 2sn.net> wrote:

>
> But let's make str() of a slice more suggestive of actual slicing, and
>> as a bonus, make slices easier to create too.
>>
>>     str(slice(None, None, None)) => "slice[:]"
>>
>
> following all the later discussion, I'd like to come back to this initial
> part of this thread:
> An even briefer for for just "str" would be to omit the 'slice' part
>
>     str(slice(None, None, None)) => "[:]"
>
> etc.  Since it has colons in there, it's clear it is a slice.  And it is
> very brief notation.
>

It is also confusing -- it is surrounded by [] but it is not a list (not
even close).

-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20161113/cba23738/attachment.html>


More information about the Python-ideas mailing list