Raise X or Raise X()?

bvdp bob at mellowood.ca
Sun Mar 11 20:04:55 CET 2012

Which is preferred in a raise: X or X()? I've seen both. In my specific case I'm dumping out of a deep loop:

  for ...
    for ...
      for ...
        if match:
           raise StopInteration()
         else ...

except StopInteration:
   print "found it"

More information about the Python-list mailing list