goto

Comcast elbertlev at comcast.net
Mon Jul 18 09:04:48 EDT 2005


In python there is no goto statement. In C I use goto only in one case: to
exit more then one level of blocks (as a matter of fact, I always use goto
EXIT in C, where EXIT is the label of the end of the function).

In python you can mimic this by throwing an exception and catching it.
Exception should "know" the destination label name and the catch statement
should compare this name  with its (catch statement) name.


"Hayri ERDENER" <hayrierdener at gmail.com> wrote in message
news:mailman.1853.1121687294.10512.python-list at python.org...
hi,
what is the equivalent of C languages' goto  statement in python?
best regards





More information about the Python-list mailing list