Bug in string.find

Ron Adam rrr at ronadam.com
Sat Sep 3 20:30:37 CEST 2005

Terry Reedy wrote:

>>    b[-1:] = ['Z']    # replaces last item
>>    b[-1:-0] = ['Z']  # this doesn't work
>>If you are using negative index slices, you need to check for end
>>conditions because you can't address the end of the slice in a
>>sequential/numerical way.
> OK, now I understand your question, the answer 'get a one's complement 
> machine', and your point that without a -0 separate from +0, there is a 
> subtle asymmetry that is easy to overlook.

Yes, I don't thinks it falls in the catagory of bugs,  probably closer 
to a minor wart.

>>>As I posted before (but perhaps it arrived after you sent this), one 
>>>indexing rounds down, introducing a slight asymmetry.
>>I didn't see that one,
> Perhaps you did not see my other long post, where I drew ascii pictures?

Yes, I saw it.  I think we are expressing the same things in different ways.

> In the US (and UK?), the ground level floor of a multifloor building is the 
> first floor.  In continental Europe (all or just some?), the ground floor 
> is the ground (effectively zeroth) floor while the first floor up is the 
> first stage (resting place on the stairway).

In the VA Hospital here in Tampa, the ground floor in the front elevator 
is on the same level as the lobby, while the ground floor in the 
elevator on the other side of the building is on the floor below. ;-)

>>I don't think people would miss negative strides much if they were
>>removed. Replacing these case's with reverse() methods shouldn't be that
> Yes, the introduction of reversed partly obsoleted the use of negative 
> strides, at least outside of its numerical array origin.
> Terry J. Reedy

More information about the Python-list mailing list