On Mon, Nov 30, 2009 at 7:50 PM, Dave Angel <da...@ieee.org> wrote:

> And this
> example could be made more complex if outer() is a generator, in which case
> it may not have actually ended when inner gets called.

Indeed.

In [8]: def gen():
   ...:     for i in range(5):
   ...:         def inner():
   ...:             print i
   ...:         yield inner

In [9]: g = gen()

In [10]: outer = g.next()

In [11]: outer()
0

In [12]: g.next()

In [13]: outer()
1

Kent
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to