python "jump" or "goto" commands?

Skip Montanaro skip at pobox.com
Wed May 30 20:46:57 EDT 2001


    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

-- 
Skip Montanaro (skip at pobox.com)
(847)971-7098




More information about the Python-list mailing list