[Python-Dev] Those import related syntax errors again...

Fredrik Lundh fredrik@effbot.org
Thu, 22 Feb 2001 10:48:49 +0100


> BTW, are people similarly opposed to that comparisons can now raise
> exceptions?  It's been mentioned a few times on c.l.py this week, but
> apparently not (yet) by people who bumped into it in practice.

but that's not a new thing in 2.1, is it?

Python 1.5.2 (#0, May  9 2000, 14:04:03) [MSC 32 bit (Intel)] on win32
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> class spam:
...     def __cmp__(self, other):
...             raise "Hi tim!"
...
>>> a = [spam(), spam(), spam()]
>>> a.sort()
Traceback (innermost last):
  File "<stdin>", line 1, in ?
  File "<stdin>", line 3, in __cmp__
Hi tim!

Cheers /F