[Python-Dev] Fw: list.index(..) -> TypeError bug or feature?

Fredrik Lundh fredrik@effbot.org
Tue, 6 Feb 2001 18:41:55 +0100


(from comp.lang.python)

can this be fixed?  should this be fixed?  (please?)

</F>

----- Original Message ----- 
From: "Pearu Peterson" <pearu@cens.ioc.ee>
Newsgroups: comp.lang.python
Sent: Tuesday, February 06, 2001 2:42 PM
Subject: list.index(..) -> TypeError bug or feature?


> 
> 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