python "jump" or "goto" commands?

Rainy sill at optonline.net
Thu May 31 14:51:36 EDT 2001


On Wed, 30 May 2001 19:46:57 -0500, Skip Montanaro <skip at pobox.com> wrote:
> 
>     eric> I'd like to know if python has commands similar to "jump" or
>     eric> "goto".
> 
> People use try/except to break out of multiple levels of nesting.  For
> instance:
> 
>     class Label(Exception): pass
> 
>     try:
>         for i in range(100):
> 	    for j in range(100):
> 	        if i*j > 2500:
> 		    raise Label
>     except Label:
>         pass
> 

Or a function with a return statement.. that personally feels a cleaner to me.


-- 
The point of philosophy is to start with something so simple as not
to seem worth stating, and to end with something so paradoxical
that no one will believe it.



More information about the Python-list mailing list