Replace for Goto

Chad Netzer cnetzer at mail.arc.nasa.gov
Wed May 28 22:48:49 EDT 2003


On Wed, 2003-05-28 at 19:18, Peter Hansen wrote:

> Hmm... maybe modifying Gerhard's example like this would be more 
> comfortable to a BASIC person:  ( ;-) )
> 
> def goto(label): pass
> 
> while 1:  # assign a label to this line
>     # do stuff
>     answer = raw_input('blah blah? (y/n)').upper()
>     if answer == 'N':
>         break
>     goto('while 1')  # branch back to labelled line  ;-)

Wow, that is definitely the silliest thing I've seen all week (and I've
been looking at MY old code, recently).  It would definitely leave me
scratching my head for a few, if I just happened across it in some
random code.  I might have to sprinkle it around, to see who is paying
attention.

ouchly-yours,

-- 

Chad Netzer
(any opinion expressed is my own and not NASA's or my employer's)






More information about the Python-list mailing list