Trees

Rustom Mody rustompmody at gmail.com
Tue Jan 20 13:35:25 EST 2015


On Tuesday, January 20, 2015 at 11:46:11 PM UTC+5:30, Rustom Mody wrote:
> On Tuesday, January 20, 2015 at 10:51:13 PM UTC+5:30, Ian wrote:
> > On Tue, Jan 20, 2015 at 6:33 AM, Rustom Mody  wrote:
> > > # Converting to generators is trivial
> > > =====================
> > 
> > :-)
> 
> Less trivial than I thought...
> Why does this not work?
> 
> def dfsg(t):
>     if t[0] == L:
>         yield t[1]
>     else:
>          yield from dfsg(t[2])
>          yield from dfsg(t[3])

Ok got it
Forgot the
«yield t[1]»
before the two yield-from's



More information about the Python-list mailing list