[Python-Dev] Re: [Python-checkins] python/dist/src/Objectslistobject.c,2.153,2.154

Neal Norwitz neal@metaslash.com
Tue, 17 Jun 2003 09:57:22 -0400


Moving to python-dev.

On Tue, Jun 17, 2003 at 09:28:50AM -0400, Raymond Hettinger wrote:
> 
> I suppose we could have more debate after the fact,
> but this one seems straight-forward enough:
> 
> * discussed on comp.lang.python
> * had an RFE on SF
> * has clear use cases
> * got a +1 from Guido
> * is backwards compatible
> * matches the signature of str.index() and unicode.index()
> * matches the search technique for regular expressions
> * was a relatively simple coding change
> * checked in with thorough tests

While overall I think the idea is worthwhile, I have two concerns:
 * the doc wasn't updated
 * negative indices are handled differently:

        >>> 'abc'.split().index('a', -3)
        Traceback (most recent call last):
          File "<stdin>", line 1, in ?
        ValueError: list.index(x): x not in list
        >>> 'abc'.index('a', -3)
        0

Neal

> ----- Original Message ----- 
> From: "Barry Warsaw" <barry@python.org>
> 
> This seems like a pretty significant change to Python's API (or at least
> one of its more common built-ins).  Given that Python 2.3 is in beta,
> I'm wondering how wise it is to add this feature.  I'm sure I missed the
> python-dev debate about it <wink>.