Re: __iter__ yield

2008-03-11 Thread Lie
On Mar 10, 3:58 am, duccio <[EMAIL PROTECTED]> wrote: > Hello! > Someone knows if it's possible to make this __iter__ function with just > one 'yield' intead of two? > Is there some simpler way to make this __iter__ iter through all nodes? > Thanks! > > class Node: > def __init__(self, data=N

Re: __iter__ yield

2008-03-10 Thread Boris Borcic
Paul Hankin wrote: > On Mar 10, 3:12 am, George Sakkis <[EMAIL PROTECTED]> wrote: >> On Mar 9, 7:37 pm, Paul Hankin <[EMAIL PROTECTED]> wrote: >> >> >> >>> On Mar 9, 8:58 pm, duccio <[EMAIL PROTECTED]> wrote: Someone knows if it's possible to make this __iter__ function with just one 'yie

Re: __iter__ yield

2008-03-10 Thread Paul Hankin
On Mar 10, 3:12 am, George Sakkis <[EMAIL PROTECTED]> wrote: > On Mar 9, 7:37 pm, Paul Hankin <[EMAIL PROTECTED]> wrote: > > > > > On Mar 9, 8:58 pm, duccio <[EMAIL PROTECTED]> wrote: > > > > Someone knows if it's possible to make this __iter__ function with just > > > one 'yield' intead of two? >

Re: __iter__ yield

2008-03-09 Thread George Sakkis
On Mar 9, 7:37 pm, Paul Hankin <[EMAIL PROTECTED]> wrote: > On Mar 9, 8:58 pm, duccio <[EMAIL PROTECTED]> wrote: > > > Someone knows if it's possible to make this __iter__ function with just > > one 'yield' intead of two? > > ... > > def __iter__(self): > > yield self #1 > >

Re: __iter__ yield

2008-03-09 Thread Paul Hankin
On Mar 9, 8:58 pm, duccio <[EMAIL PROTECTED]> wrote: > Someone knows if it's possible to make this __iter__ function with just   > one 'yield' intead of two? > ... >      def __iter__(self): >          yield self #1 >          for n in self.childs: >              for nn in n.__iter__(): >          

Re: __iter__ yield

2008-03-09 Thread Diez B. Roggisch
duccio schrieb: > > Hello! > Someone knows if it's possible to make this __iter__ function with just > one 'yield' intead of two? > Is there some simpler way to make this __iter__ iter through all nodes? > Thanks! > > class Node: > def __init__(self, data=None): > self.childs=[] >