On Thu, Nov 20, 2014 at 12:34:08PM +1100, Chris Angelico wrote:
On Thu, Nov 20, 2014 at 11:25 AM, Steven D'Aprano steve@pearwood.info wrote:
Examples of code in the wild using StopIteration to exit:
http://code.openhub.net/file?fid=PTjGrE_5rOhyZhL1CUrPBtRk7n8&cid=tWtPpAs...
Trivially unnecessary, and as soon as there's a bug report, the "What's New In 3.7" page will explain that it needs to be removed.
The point isn't that it is easy to fix. I'm sure that there will be cases of code that are not easy to fix. The point is that we're breaking working code and causing code churn.
We're not fixing a bug. We're changing behaviour people rely on. That ought to make us more conservative about breaking their code.
This may result in the odd question here or there, but it's not a major problem.
And neither is the existing behaviour. We're weighing up whether the small benefit in fixing this wart is worth the pain. The PEP isn't approved yet, and right from the beginning Guido said that he feared that fixing this might be too disruptive. I'm trying to get a feel for how disruptive it will be.
I did a quick and informal survey of the developers I work with. The dreaded lurgy has gone through our office, so most of them are away ill, but of those still here (all two of them) one of them couldn't remember whether you exit a generator with "yield nil" or "return nil" (he's a Ruby and Objective-C guy when we're not paying him to write Python) and the other one said that the whole problem is that generators exist in the first place, Python should get rid of them and allow people to define their own using macros (he likes to think of himself as a Lisp and Scheme guru :-)
Make of that what you will.