Recursive function returning a list
Boris Borcic
bborcic at gmail.com
Tue Jul 18 11:28:16 EDT 2006
Hello Bruno,
Bruno Desthuilliers wrote:
> 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 !-)
>
Sorry, but I don't understand your reasoning. How can you exclude that the OP
/may/ find that a generator neatly solves his problem ? The use of a default
value was not an end in itself, was it ?- and the quirks of default values being
FAQ stuff don't change that. Sure if nobody had covered that aspect, but a
couple other posters did...
Mmmmhhh somehow it feels like if there is any issue here, it is about defending
the credo "there ought to exist only one obvious way to do it" ?...
Cheers, BB
--
666 ?? - 666 ~ .666 ~ 2/3 ~ 1-1/3 ~ tertium non datur ~ the excluded middle
~ "either with us, or against us" !!
More information about the Python-list
mailing list