Re: Slices by length

MRAB <[email protected]>
Newsgroups gmane.comp.python.general
Message-ID <[email protected]>

On 08/10/2025 03:21, Richard Damon wrote:
> Sent from my iPad
>
>> On Oct 7, 2025, at 9:59 PM, Rob Cliffe via Python-list <[email protected]> wrote:
>>
>> In fairness, it is already possible to write
>>       s[x:][:n]
>> which gives the "right" answer if n is non-negative, and is quite readable,
>> although this is slower than s[x:x+2], at least in tests that I did (and, I would hazard a guess, always).
>> Best wishes
>> Rob Cliffe
>>
> Which brings to mind a possible alternate syntax: s[x::n]
> Won’t say I think it is good enough to say that is how it should be, just throwing a new hat in the ring.
That syntax already exists.
-- 
https://mail.python.org/mailman3//lists/python-list.python.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.