goto

Gerhard Haering gh at ghaering.de
Mon Jul 18 11:55:48 EDT 2005


On Mon, Jul 18, 2005 at 08:40:16AM -0700, Kay Schluehr wrote:
> Hayri ERDENER schrieb:
> > hi,
> > what is the equivalent of C languages' goto  statement in python?
> > best regards
> 
> No, but some of goto's use cases can be covered by unconditional jumps
> provided by exceptions. [...]

I like the "named loops" concept of other HLL like Ada 95 or Java better
than either goto or exceptions. It allows you to use "break" and
"continue" for other than the innermost loops, too:

    break;              => break out of inner loop
    break loop_name;    => break out of named loop "loop_name"

OTOH it's not used *that* often, so I won't argue for including it in
Python ;)

-- Gerhard
-- 
Gerhard Häring - gh at ghaering.de - Python, web & database development
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: Digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20050718/3a115590/attachment.sig>


More information about the Python-list mailing list