On 3/1/17, Wolfgang Maier <wolfgang.ma...@biologie.uni-freiburg.de> wrote:
> - as explained by Nick, the existence of "except break" would strengthen > the analogy with try/except/else and help people understand what the > existing else clause after a loop is good for. I was thinking bout this analogy: 1. try/else (without except) is SyntaxError. And seems useless. 2. try/break/except is backward compatible: for i in L: try: break except Something: pass except break: # current code has not this so break is applied to for-block 3. for/raise/except (which is natural application of this analogy) could reduce indentation but in my personal view that don't improve readability (but I could be wrong) It could help enhance "break" possibilities so "simplify" double break in nested loops. for broken = False for if condition1(): # I like to "double break" here raise SomeError() if condition2(): break except SomeError: break except break: broken = True 4. for/finally may be useful _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/