[email protected] wrote:
def fg(args):
if not args:
yield ""
return
for i in args[0]:
for tmp in fg(args[1:]):
yield i + tmp
return
The final return is redundant, since there is an implicit return
at the end, just like an ordinary function. The other one is just
performing an early exit from the iteration. You could write it
without any returns like this:
def fg(args):
if not args:
yield ""
else:
for i in args[0]:
for tmp in fg(args[1:]):
yield i + tmp
this is the Tower of Hanoi with recursive generator but it do
> not have the 'return' here
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list