On Wed, Jun 28, 2017 at 5:49 AM, Sven R. Kunze <[email protected]> wrote: > On 27.06.2017 13:41, Nick Coghlan wrote: >> >> The shallow exception notion breaks a fairly fundamental refactoring >> principle in Python: you should be able to replace an arbitrary >> expression with a subfunction or subgenerator that produces the same >> result without any of the surrounding code being able to tell the >> difference. > > > I would agree with you here but this "refactoring principle in Python" > doesn't work for control flow. > > Just look at "return", "break", "continue" etc. Exceptions are another way > of handling control flow. So, this doesn't apply here IMO.
The ability to safely refactor control flow is part of why 'yield from' exists, and why PEP 479 changed how StopIteration bubbles. Local control flow is hard to refactor, but exceptions are global control flow, and most certainly CAN be refactored safely. ChrisA _______________________________________________ Python-ideas mailing list [email protected] https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
