[Python-bugs-list] [ python-Bugs-511876 ] UserList.__cmp__() raises RuntimeError

noreply@sourceforge.net noreply@sourceforge.net
Fri, 01 Feb 2002 12:23:05 -0800


Bugs item #511876, was opened at 2002-02-01 12:14
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=511876&group_id=5470

Category: Python Library
Group: Python 2.1.2
>Status: Closed
>Resolution: Works For Me
Priority: 5
Submitted By: Barry Warsaw (bwarsaw)
>Assigned to: Guido van Rossum (gvanrossum)
Summary: UserList.__cmp__() raises RuntimeError

Initial Comment:
Summary says it all.  The trunk version of this method
(i.e. Python 2.2) doesn't raise this exception.  Was
this even intended?  It makes it difficult to write
derived classes that work under both Python 2.1.x and
Python 2.2.


----------------------------------------------------------------------

>Comment By: Guido van Rossum (gvanrossum)
Date: 2002-02-01 12:23

Message:
Logged In: YES 
user_id=6380

It was intentional that __cmp__ raised an error, because it
wasn't supposed to be called any more -- as of 2.1, rich
comparisons take priority.

Try it: if you cmp() a UserList instance in 2.1, you don't
get an exception, because __cmp__ isn't called.

You only ran into this because you were using UserList as a
mix-in class for ExtensionClass, which doesn't support rich
comparisons.

I don't think it's a bug, and I'm closing it as Works For
Me.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=511876&group_id=5470