Syntax to catch specific exceptions ?

Greg Ewing greg at cosc.canterbury.ac.nz
Mon Mar 11 19:08:22 EST 2002


pekka niiranen wrote:
> 
> So I will end up writing function with a huge "if-else"-structure
> under except -clause
> that catches all cases I want react to? Sounds like C. Perkele ;)

You could keep a tuple of all the error numbers
you're interested in somewhere and use 'in' to
test membership of it.

-- 
Greg Ewing, Computer Science Dept, University of Canterbury,	  
Christchurch, New Zealand
To get my email address, please visit my web page:	  
http://www.cosc.canterbury.ac.nz/~greg



More information about the Python-list mailing list