Control of flow

Terry Reedy tjreedy at home.com
Tue Jul 31 14:43:09 EDT 2001


"Campbell" <cb921 at voice.co.za> wrote in message
news:Pine.LNX.4.31.0107311355450.2321-100000 at cb921.local...
> I use python to write telephony apps, and I find that a 'goto' is
often
> a nice tool (stop going 'aargh', its properly "useful" sometimes =).

Indeed.  Once, when revising a Unix serial port driver, I used a goto
to efficiently escape from three levels of nested loops.  Very useful
there :-).

However, using them to emulate, one at a time, state transition
machines, seems like a road to madness, as in "> It gets worse quite
easily".

Given that you said 'apps' plural, and the example you gave thereof, I
would first design a state transition structure that is specific to
your application class but generic within it: initial and intermediate
states are 'get data x with prompt x.vox'; terminal states are 'here
is result y.  thank you <click>".  Then I would write a program to
execute the machine defined by a particular set of states.

At this point, 'programming' an app within the class would consist of
drawing a transition diagram, which a client could inspect and sign
off on, and then translating to the defined structure.

Terry J. Reedy






More information about the Python-list mailing list