Message25840
The example below shows that list(f) swallows the
KeyboardInterrupt.
It swallows any other exception too, such as
MemoryError or application-specific ConflictErrors.
I think the "get the length of the object" optimisation
should catch only AttributeError and TypeError.
>>> class F(object):
... def __iter__(self):
... yield 23
... def __len__(self):
... print "len called. raising Keyboard
Interrupt."
... raise KeyboardInterrupt
...
>>> f = F()
>>> list(f)
len called. raising Keyboard Interrupt.
[23]
|
|
Date |
User |
Action |
Args |
2007-08-23 14:33:14 | admin | link | issue1242657 messages |
2007-08-23 14:33:14 | admin | create | |
|