Python code written in 1998, how to improve/change it?

skip at pobox.com skip at pobox.com
Wed Jan 25 16:46:50 EST 2006


    Wolfgang> So basically if I want to write a long-running program in
    Wolfgang> Python, it would make sense to code all functions that are
    Wolfgang> likely to be called more than once as generators...

    Skip> If they need to resume their calculations from where they left off
    Skip> after the last yield.

    Bengt> Hm, I wonder how (all untested)
    ...
    Bengt> would compare to
    ...

I was thinking about things like complex tokenizers.  Take a look, for
example, at the SpamBayes tokenizer and think about how to implement it
without yield.  Clearly it can be don (and not all that difficult).  Still,
I think the generator version would be easier to understand and modify.

Skip



More information about the Python-list mailing list