break LABEL vs. exceptions + PROPOSAL

C

Chris Rebert

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.

• break labels have been refused into python
• we can do it anyway using exceptions
• this is a proposal for something better, resembling "the exception
way" and much more powerful and python-like than break labels

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

Cheers,
Chris
 
T

Terry Reedy

I think it went unnoticed because it is not very good, once looked at.
So the proposal is not needed

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
 
L

Lo'oris

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

there would be abbreviation: you wouldn't have to declare somewhere a
dummy exception class.
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.

no: if you mismatch a label in this case, it should be treated as a
syntax error, not as an
unhandled exception which you might not notice.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top