Recursive function returning a list
Bruno Desthuilliers
onurb at xiludom.gro
Tue Jul 18 09:42:57 EDT 2006
Boris Borcic wrote:
>> Do you have any ideas?
>
>
> you could use a recursive generator, like
>
> def genAllChildren(self) :
> for child in self.children :
> yield child
> for childchild in child.genAllChildren() :
> yield childchild
Or how to *not* address the real problem...
Boris, using a generator may be a pretty good idea, but *not* as a way
to solve a problem that happens to be a FAQ !-)
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"
More information about the Python-list
mailing list