if or exception

Thomas Lindgaard thomas at it-snedkeren.BLACK_HOLE.dk
Thu Jul 29 10:13:16 CEST 2004


Hi

Just wondering what is "the right thing to do":

number = 0
if len(list) > 0: number = anotherNumber / len(list)

or 

try:
  number = anotherNumber / len(list)
except:
  number = 0

-- 
Regards
/Thomas




More information about the Python-list mailing list