while/break - The pure-python FSM implementation to Rule Them All.

2006-01-25 Thread Carl Cerecke
Well, it doesn't quite rule them all, but it is fast: About three times faster than using one function per state. Faster than using generators. Faster than using code objects. Some, possibly minor, problems: 1. The generated code is ugly. 2. The generated code can be quite large, depending on

Re: while/break - The pure-python FSM implementation to Rule Them All.

2006-01-25 Thread Paul Rubin
Carl Cerecke [EMAIL PROTECTED] writes: 3. Not as fast as byte code hacks, or using pyrex/psyco. Peter Hansen is right. One of those is likely a better solution if you don't need pure python. If you don't need pure python than your approach still beats everything else. Just generate C code (or

Re: while/break - The pure-python FSM implementation to Rule Them All.

2006-01-25 Thread Carl Cerecke
Paul Rubin wrote: Carl Cerecke [EMAIL PROTECTED] writes: 3. Not as fast as byte code hacks, or using pyrex/psyco. Peter Hansen is right. One of those is likely a better solution if you don't need pure python. If you don't need pure python than your approach still beats everything else.