Can a simple a==b 'hang' in and endless loop?

Steven D'Aprano steve at REMOVETHIScyber.com.au
Fri Jan 20 22:40:37 EST 2006


On Sat, 21 Jan 2006 01:12:28 +0100, Claudio Grondi wrote:

> Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on 
> win32 - IDLE 1.1.2
>  >>> a=[]
>  >>> a.append(a)
>  >>> b=[]
>  >>> b.append(b)
>  >>> a==b
> 
> Traceback (most recent call last):
>    File "<pyshell#4>", line 1, in -toplevel-
>      a==b
> RuntimeError: maximum recursion depth exceeded in cmp
>  >>>

Works for me:


Python 2.3.3 (#1, May  7 2004, 10:31:40)
[GCC 3.3.3 20040412 (Red Hat Linux 3.3.3-7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> a = []
>>> a.append(a)
>>> b = []
>>> b.append(b)
>>> a == b
True


Maybe IDLE is playing silly buggers, or perhaps Python 2.4.2 has a bug.


-- 
Steven.




More information about the Python-list mailing list