Steven Bethard wrote: > I wonder if it > would be possible to update PEP 310 with your ideas, or perhaps start > a new PEP? I'd like to see a competitor for PEP 340 that addresses > some of the issues that came up, e.g. that the block-statement doesn't > look like a loop, so break and continue might look like they break out > of an enclosing loop. It might also be a good place to mirror Guido's > PEP 340 examples with PEP 310-style examples -- I know the first > attempts at writing some of them weren't as clean as the later > attempts, so it would be nice to have somewhere to look for the > "current version" of everything.
Well, Michael Hudson and Paul Moore are the current authors of PEP 310, so updating it with any of my ideas would be their call. Either way, my latest and greatest version of the non-looping block statement semantics can be found here: http://mail.python.org/pipermail/python-dev/2005-May/053400.html Some key advantages of that proposal are: 1. It's not a loop, so nesting it inside another loop 'just works' 2. Manual protocol implementations are _significantly_ easier to write 3. try/finally can be done with generators _without_ changing generators 4. try/except/else can be done with generators if they provide an __exit__ method that raises the exception at the point of the last yield 5. Clearly distinct construct, no potential for confusion with for loops 6. Generators must be clearly marked as creating a user defined statement (although this could be changed by giving them an __enter__ method and an __exit__ method) The one downside relative to PEP 340 is that looping constructs like auto_retry are slightly harder to write, albeit not hugely so (once you remember that an iterable can be a class instead of a generator!). On the usage front, I find the 'loop over an iterator returning user defined statements' does a much better job of making the iteration clear, so I'd be inclined to count that as an advantage of a PEP 310 style approach. Anyway, I've already been spending more time on this than I should (sleep is optional, right?), so I won't be prettying it up into PEP format any time soon. I have no objection to someone else rolling some of the ideas into a PEP, though :) Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --------------------------------------------------------------- http://boredomandlaziness.skystorm.net _______________________________________________ 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