Raise X or Raise X()?

bvdp bob at mellowood.ca
Sun Mar 11 15:04:55 EDT 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:

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

except StopInteration:
   print "found it"



More information about the Python-list mailing list