try: except <never>:

Paul Rubin http
Tue Jan 10 08:04:04 EST 2006


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: 
  ...



More information about the Python-list mailing list