retry in try:...except:

Fredrik Lundh fredrik at pythonware.com
Sun Feb 11 22:59:30 CET 2001


Dan Parisien wrote:
> try:
>         something()
> except:
>         fix_possible_error()
>         retry

while 1:
    try:
        something()
    except:
        fix_possible_error()
    else:
        break

> for i in indexes(list):
>         do_something( list[i] )

for item in list:
    do_something(item)

(or "def indexes(list): return range(len(list))")

Cheers /F





More information about the Python-list mailing list