Wolfgang Keller wrote: >>what makes you think that resuming a generator won't involve function >>calls ? > > That was not what I wrote. > > I referred to what Peter Hansen <[EMAIL PROTECTED]> wrote in > [EMAIL PROTECTED]: > >>I believe the more modern approach to this is to use generators in some >>way, yield each other as the next state. This way you avoid all almost >>all the function call overhead (the part that takes significant time, >>which is setting up the stack frame) > > The way I understand this, resuming a generator causes less overhead than the > inital overhead of a function call.
I think in the spirit of avoiding "premature optimization" and all things related, now is the time to re-inject the other part of my above-quoted posting, where I also said: """ Of course, if you have a state machine with many small states each doing a tiny bit of processing and you're still concerned over performance, you probably should be looking into Pysco or Pyrex and avoid making your code really unreadable. """ -Peter -- http://mail.python.org/mailman/listinfo/python-list