How "expensive" are Exceptions?
Michael 'Mickey' Lauer
mickey at tm.informatik.uni-frankfurt.de
Sun Mar 10 18:01:51 EST 2002
Hi, given the fact that excpetion handling can be very
expensive in languages like C++ - is python similar in
this aspect?
For instance, given somefunc() which sometimes (often)
returns a tuple and sometimes (rare) an integer - which version
would be to prefer?
Which version would be to prefer if the return types
are distributed evenly?
a)
try:
a, b = somefunc()
except:
return None
...
b)
selection = somefunc()
if len( selection ) != 2:
return None
else:
model, iter = selection
...
Yours,
Mickey.
More information about the Python-list
mailing list