Very Horrible Question About Goto's
Michael Hudson
mwh21 at cam.ac.uk
Wed Apr 19 11:46:36 EDT 2000
Michael Hudson <mwh21 at cam.ac.uk> writes:
> Gaetan Corneau <corg at copernic.com> writes:
>
> > I was surprised to learn that Python doesn't have a goto statement.
> > Would it be difficult to add?
>
> No. The necessary opcodes are there (well, the one you need:
> JUMP_ABSOLUTE). You could use bytecodehacks to implement it, if you
> liked...
Oh, hang on: the block stack would cause problems; how would you get
def f(x):
label: bob
for i in x:
if x:
goto: bob
to work? (by declaring it to be an error, I suppose).
Cheers,
M.
--
41. Some programming languages manage to absorb change, but
withstand progress.
-- Alan Perlis, http://www.cs.yale.edu/~perlis-alan/quotes.html
More information about the Python-list
mailing list