goto, cls, wait commands

Nick Craig-Wood nick at craig-wood.com
Fri Feb 11 13:30:02 EST 2005


Grant Edwards <grante at visi.com> wrote:
>  I forgot to mention try/except.  When I do use goto in C
>  programming it's almost always to impliment what would have
>  been a try/except block in Python.

Yes I'd agree with that.  No more 'goto out'.

There is this also

    for (i = 0; ...)
    {
        if (something)
            goto found;
    }
    /* do stuff when not found */
    found:;

(yes I hate setting flags in loops ;-)

This translates exactly to the for: else: construct

    for i in xrange(...):
        if something:
            break
    else:
        # do stuff when not found

The last language I saw with this very useful feature was FORTH in
about 1984!

-- 
Nick Craig-Wood <nick at craig-wood.com> -- http://www.craig-wood.com/nick



More information about the Python-list mailing list