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. When a user creates their own exception for exiting multiple levels of loops or frames, should they inherit from ControlFlowException on the theory that it no different in intent from StopIteration or should they inherit from UserError on the theory that it is a custom exception? Do you really want routine control-flow exceptions to bypass "except Exception". I suspect that will lead to coding errors that are very difficult to spot (it sure looks like it should catch a StopIteration). Be careful with these proposals. While well intentioned, they have ramifications that aren't instantly apparent. Each one needs some deep thought, user discussion, usability testing, and a darned good reason for changing what we already have in the field. Raymond _______________________________________________ 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