Why no 'elif' in try/except?

Carsten Gaebler clpy at snakefarm.org
Sun Jun 3 11:44:14 CEST 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