enhancing slicing

Bengt Richter bokr at accessone.com
Thu Aug 23 22:47:02 CEST 2001


On Thu, 23 Aug 2001 19:55:13 GMT, bokr at accessone.com (Bengt Richter) wrote:

>On Thu, 23 Aug 2001 15:21:47 +0200, "Alex Martelli" <aleax at aleax.it> wrote:
>
[...]
>>Further, it's such an EASY thing to do -- the proposed
>>    a[b # c]
>>is EXACTLY the same as
>>    a[b:b+c]
>>so where's the added value to justify something as major
>>as adding a new operator...?
>>
>I would rather have the alternative syntax
>    a[b:+c]
>
Actually, I think my later post is better, suggesting
    a[b:+=c]
as short (assuming >1 letter expressions ;-) for
    a[b:b+c]
I.e., a general pattern where 'op=' operates
with the other slice parameter to make a value.
    a[-=c:b]
would be short for
    a[b-c:b]




More information about the Python-list mailing list