break LABEL vs. exceptions + PROPOSAL

Terry Reedy tjreedy at udel.edu
Wed Nov 18 13:13:11 EST 2009


Chris Rebert wrote:
> On Wed, Nov 18, 2009 at 4:05 AM, Lo'oris <looris at gmail.com> wrote:
>> I've found this email, back from 10 years ago:
>> http://mail.python.org/pipermail/python-list/1999-September/009983.html
>>
>> I guess it went unnoticed, because that proposal looks really
>> intresting.

I think it went unnoticed because it is not very good, once looked at.
>>
>> • break labels have been refused into python
>> • we can do it anyway using exceptions

So the proposal is not needed

>> • this is a proposal for something better, resembling "the exception
>> way" and much more powerful and python-like than break labels

It amounts to duplicating raise x...exception x as break x....continue x 
in the name of aesthetics and supposed efficiency. There would be no new 
functionality nor any abbreviation of code. The semantics of 
break/continue as specific loop subcommands would be changed to 'use 
anyplace'. The OP gives as a reason the possibility of a typo creating a 
raise x ... except y mis-match. But a break x ... continue y mismatch is 
equally likely.

Anyway, I think the example given would be better written with immediate 
assignment followed by simple break, rather than the proposed delayed 
assignment.

The exception example as given would have to be rewritten to work in 3.x.

> You're gonna have to wait 18-24 months:
> http://www.python.org/dev/peps/pep-3003/
> 
> Also, the python-ideas list might be a better forum for discussing
> this than the general-interest list:
> http://mail.python.org/mailman/listinfo/python-ideas

This is a fine place to discuss it.

Terry Jan Reedy





More information about the Python-list mailing list