try: except <never>:

Hallvard B Furuseth h.b.furuseth at usit.uio.no
Tue Jan 10 08:27:23 EST 2006


Paul Rubin writes:
>Hallvard B Furuseth <h.b.furuseth at usit.uio.no> writes:
>> 'except None:' works for now, but I don't know if that's safe:
>>
>>     for ex in ZeroDivisionError, None:
>>         try:
>>             1/0
>>         except ex:
>>             print "Ignored first exception."
>
> class NeverRaised(Exception): pass
>
> for ex in ZeroDivisionError, NeverRaised:

Heh.  Simple enough.  Unless some obstinate person raises it anyway...

-- 
Hallvard



More information about the Python-list mailing list