list.index(..) -> TypeError bug or feature?

Pearu Peterson pearu at cens.ioc.ee
Tue Feb 6 14:42:55 CET 2001


In Python 2.1a2 I get TypeError exception from list index() method even if
the list contains given object:

>>> from gmpy import mpz
>>> a = [mpz(1),[]]
>>> a.index([])
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: coercion to gmpy.mpz type failed

while in Python 2.0b2 it works:

>>> a = [mpz(1),[]]
>>> a.index([])
1

Is this Python 2.1a2 bug or gmpy bug? Or my bug and Python 2.1 feature?

Thanks,
	Pearu




More information about the Python-list mailing list