K Viltersten
3/1/2008 9:34:00 PM
>> I'm reading the docs and at 5.2 the del
>> statement is discussed. At first, i thought
>> i've found a typo but as i tried that
>> myself, it turns it actually does work so.
>>
>> a = ["alpha", "beta", "gamma"]
>> del a[2:2]
>> a
>>
>> Now, i expected the result to be that the
>> "beta" element has been removed. Obviously,
>> Python thinks otherwise. Why?!
>
> Remember that slices are specified as half-open
> intervals. So a[m:n] includes m-n elements,
> those indexed from m to n-1.
Got it. Thanks!
--
Regards
Konrad Viltersten
--------------------------------
sleep - a substitute for coffee for the poor
ambition - lack of sense to be lazy