Is there a programming language that is combination of Python and Basic?

Steven D'Aprano steve at
Sat Apr 18 09:39:15 CEST 2009

On Fri, 17 Apr 2009 20:45:30 -0700, Mensanator wrote:

>> Nevertheless, somebody *has* implemented such functionality in Python.
>> Not just GOTO, but also COMEFROM.
> Really? Well, _I_ for one, won't be beating a path to his door.

Well you should. It's very clever code, and the way he solved the 
"problem" is intriguing. It was also a great April Fools joke.

For reference, here's that URL again:

>> GOTO in Pascal required that you defined a label in your code, then you
>> could jump to that label. You can't jump to arbitrary parts of the
>> program, only within the current procedure.
> And I deliberately made no effort to learn how to use them. And I never
> had a situation I couldn't solve the "proper" way.

You need to distinguish between the use of unstructured jumps like Basic-
style GOTOs and COMEFROMs, which can jump anywhere, and the use of 
structured GOTOs and jumps that have well-defined meanings. GOTO, after 
all, is just a jump, and we use jumps in Python all the time:

raise Exception
if... elif... else...
for... else...

Often -- well, sometimes -- you can write cleaner, simpler code with GOTO 
than without. Fortunately, 95% of those cases can be dealt with a break 
or continue in a loop. In a high level language, GOTO is never necessary 
and rarely useful, but it is useful on occasion. Any time you find 
yourself creating a flag variable just so you can skip a code block, or 
enter a code block, then a structured GOTO *could* be a clean 
replacement. But probably isn't. (This is not a call for Python to 
develop a GOTO, just a defence that they aren't always the Wrong Thing.)

COMEFROM on the other hand is just the purest evil imaginable.


More information about the Python-list mailing list