Bug in string.find

Fredrik Lundh fredrik at pythonware.com
Thu Sep 1 08:37:05 EDT 2005


Ron Adam wrote:

> The problem with negative index's are that positive index's are zero
> based, but negative index's are 1 based.  Which leads to a non
> symmetrical situations.

indices point to the "gap" between items, not to the items themselves.

positive indices start from the left end, negative indices from the righept end.

straight indexing returns the item just to the right of the given gap (this is
what gives you the perceived assymmetry), slices return all items between
the given gaps.

</F> 






More information about the Python-list mailing list