Programming Habits in Python

Keith Ray k_j_r_a_y at ix.netcom.com
Wed Dec 13 21:54:00 EST 2000


In article <910m5d$t6v$1 at slb3.atl.mindspring.net>, "Andrew Dalke" 
<dalke at acm.org> wrote:
[...]
> As yet another comparison, I've been doing a lot of work with
> mxTextTools, which uses a state table to do text processing.
> It's very fast so I rewrote some of my Python parsing code
> using it.  While there were only about 12 states, it took
> a few hours to write and debug while the Python implementation
> took about 15 minutes.
> 
> I ended up coding the example in C++ instead of Python because
> C++ has gotos and because C++'s STL includes a priority queue.
> The whole code ended up being about 5 times longer than the
> MIX example, which isn't bad since MIX puts a lot of the
> code on one line, and he didn't declare a priority queue.
[...]

Could you have put the code for each of those 12 states into separate 
classes, and put instances of those classes into a dictionary where the 
key is the state-id?

-- 

       <http://pw2.netcom.com/~kjray/>



More information about the Python-list mailing list