[IronPython] bug: list.index broken in transition from ip 0.9.5 to ip 0.9.6

Dino Viehland dinov at exchange.microsoft.com
Mon Dec 12 18:34:56 CET 2005

If you want to update your copy the fix is to update these methods in list.cs:

        public bool __contains__(object item) {
            for (int i = 0; i < size; i++) {
                if (Ops.IsTrue(Ops.Equal(data[i], item)))
                    return true;
            return false;

And then later in the file:	

        public int index(object item) {
            return index(item, 0, size);

        public int index(object item, int start) {
            return index(item, start, size);

        public int index(object item, int start, int stop) {
            //??? fix indices
            for (int i = start; i < Math.Min(stop, size); i++) {
                if (Ops.IsTrue(Ops.Equal(data[i], item))) return i;
            throw Ops.ValueError("list.index(item): item not in list");

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of J. de Hooge
Sent: Monday, December 12, 2005 4:32 AM
To: 'Discussion of IronPython'
Subject: [IronPython] bug: list.index broken in transition from ip 0.9.5 to ip 0.9.6


Yet another disguise of probably the same underlying bug:

aList = [['a']]
anItem = ['a']

print aList.index (anItem)

Traceback (most recent call last):
   at __main__.Initialize() in C:\activ_dell\prog\fun\src\funTry.py:line 4
ValueError: list.index(x): x not in list

The number of workarounds in my code is getting a bit too big now, since I
am using this everywhere.

Unfortunately I'll have to revert to 0.9.5 awaiting these things to be

Guys, you've been making a great product upto now.
My sincere respect for that.
As far as I can see the IP team has been impressively productive.
Don't know what the project pressures are, but please keep taking the time
you need!

I'd personally rather wait some more months for 1.0 than having things done
in a rush.

I propose basic stuff like this is added to the regression test suite.

Kind regards
Jacques de Hooge
info at geatec.com

users mailing list
users at lists.ironpython.com

More information about the Ironpython-users mailing list