[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A Problem with Python's 'yield'




I don't understand how this helps. Wouldn't yield_all be implemented 
with a for loop?
Or do you really mean that all values are yielded at once? But if that 
is true then:
yield self.left.in_order()
would suffice, no?

On Tuesday, May 27, 2003, at 08:15 AM, Eric Kidd wrote:

> We can shorten the code--and make it run in O(N) time--by adding a new
> keyword to replace the "for v in ...: yield v" pattern:
>
>   def in_order(self):
>       if self.left is not None:
>           yield_all self.left.in_order():
>
-- 
--- james mccartney   james@audiosynth.com   <http://www.audiosynth.com>
SuperCollider - a real time audio synthesis programming language for 
MacOS X.