Goto in python - NO! (was Re: Python code written in 1998, how to improve/change it?)

Carl Cerecke cdc at maxnet.co.nz
Thu Jan 19 18:14:05 EST 2006


Dave Hansen wrote:
> On Fri, 20 Jan 2006 10:27:58 +1300 in comp.lang.python, Carl Cerecke
> <cdc at maxnet.co.nz> wrote:
> 
> [...]
> 
>>Python has no goto.
> 
> 
> +1
> 
> [...]
> 
>>We want a goto.
> 
> 
> -1

I agree entirely. My (rather unclearly made) point was that, for the 
particular application (FSM), an unrestricted jump is really handy. Not 
that we want goto in python (Eurghhhh!!) just to make this one case easier.

I learnt programming on a Commodore-64 where BASIC programs where 
required to be liberally sprinkled with gotos (No else. Only one, 
global, scope. No real functions). I know first hand the pain gotos can 
inflict. We don't want to go back there.

But. They are still really handy for directly implementing a FSM in 
code! Hence my JUMP_ABSOLUTE bytecode rewrite hack for FSMs.

Cheers,
Carl.



More information about the Python-list mailing list