Re: [Tutor] Here is newbie doc on how to implement generators

2007-07-23 Thread Dave Kuhlman
On Mon, Jul 16, 2007 at 06:13:35PM -0400, Kent Johnson wrote: Kent - Rather than try to reply in detail to your suggestions, I've tried to ammend my document to reflect your comments. Thanks again for the help. Dave [good suggestions and corrections from Kent, snipped] -- Dave Kuhlman

Re: [Tutor] Here is newbie doc on how to implement generators

2007-07-16 Thread Kent Johnson
John Fouhy wrote: def walkTree(tree): # stack to hold nodes as we walk through stack = [] stack.append(tree) while stack: value, children = stack.pop() for child in reversed(children): # reverse children to get the right order.

Re: [Tutor] Here is newbie doc on how to implement generators

2007-07-16 Thread Kent Johnson
Dave Kuhlman wrote: On Fri, Jul 13, 2007 at 12:39:40PM +1200, John Fouhy wrote: On 13/07/07, Dave Kuhlman [EMAIL PROTECTED] wrote: And, I have a question -- If you look at the example of the iterative (non-recursive) generator (the Doubler class), you will see that it walks a list, not a

Re: [Tutor] Here is newbie doc on how to implement generators

2007-07-16 Thread Kent Johnson
Dave Kuhlman wrote: I find iterators and generators fascinating. So, in order to try to understand them better myself, I've written up some notes. I'm hoping that these notes might help someone new to the generators and iterators in Python. You can find it here:

Re: [Tutor] Here is newbie doc on how to implement generators

2007-07-13 Thread Eric Brunson
Dave Kuhlman wrote: I find iterators and generators fascinating. So, in order to try to understand them better myself, I've written up some notes. I'm hoping that these notes might help someone new to the generators and iterators in Python. You can find it here:

Re: [Tutor] Here is newbie doc on how to implement generators

2007-07-13 Thread Dave Kuhlman
On Fri, Jul 13, 2007 at 12:39:40PM +1200, John Fouhy wrote: On 13/07/07, Dave Kuhlman [EMAIL PROTECTED] wrote: And, I have a question -- If you look at the example of the iterative (non-recursive) generator (the Doubler class), you will see that it walks a list, not a tree. That's because

[Tutor] Here is newbie doc on how to implement generators

2007-07-12 Thread Dave Kuhlman
I find iterators and generators fascinating. So, in order to try to understand them better myself, I've written up some notes. I'm hoping that these notes might help someone new to the generators and iterators in Python. You can find it here:

Re: [Tutor] Here is newbie doc on how to implement generators

2007-07-12 Thread John Fouhy
On 13/07/07, Dave Kuhlman [EMAIL PROTECTED] wrote: And, I have a question -- If you look at the example of the iterative (non-recursive) generator (the Doubler class), you will see that it walks a list, not a tree. That's because I was *not* able to figure out how to implement a non-recursive