Why no 'elif' in try/except?

Carsten Gaebler clpy at snakefarm.org
Sun Jun 3 05:44:14 EDT 2001


Hi there!

How about adding an 'elif' to try/except? I.e.:

try:
  res = dosomethingnasty()
except:
  complain()
elif res == 1:
  behappy()

instead of

try:
  res = dosomethingnasty()
except:
  complain()
else:
  if res == 1:
    behappy()

Any opinions?

Regards
Carsten.



More information about the Python-list mailing list