On Tue, Nov 1, 2016 at 1:50 AM, <tpqnn...@gmail.com> wrote: > > Please see the exampl I just got it below, this is the Tower of Hanoi with > recursive generator but it do not have the 'return' here, do you have the > advice for this term: > > def A001511(): > yield 1 > b=1 > for x in A001511(): > yield x+1 > yield 1 > > > trial=A001511() > for i in range(10): > a=next(trial) > print(a)
As soon as you get to the end of the function, it returns. When you iterate over a generator, you run it to completion, taking all the values it yields. ChrisA -- https://mail.python.org/mailman/listinfo/python-list