On Aug 5, 2005, at 2:46 PM, Raymond Hettinger wrote: > The PEP moves StopIteration out from under Exception so that it cannot > be caught by a bare except or an explicit "except Exception". > > IMO, this is a mistake. In either form, a programmer is stating that > they want to catch and handle just about anything. There is a > reasonable argument that SystemExit special and should float to the > top, > but that is not the case with StopIteration.
I'm glad you brought that up. I had wondered from the beginning why ControlFlowException was moved out, but thought there must be a good reason I was just not seeing, and promptly forgot about it. So now that I've been reminded, can someone explain to me why StopIteration and GeneratorExit should not be caught by an "except:" or "except Exception:" clause? James _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com