diff -r d1e6a48dfb0d Doc/howto/functional.rst --- a/Doc/howto/functional.rst Sun Jan 20 01:31:20 2013 +0100 +++ b/Doc/howto/functional.rst Sun Jan 20 10:46:11 2013 +0530 @@ -479,13 +479,13 @@ You could equally write ``for i in generate_ints(5)``, or ``a,b,c = generate_ints(3)``. -Inside a generator function, the ``return`` statement can only be used without a -value, and signals the end of the procession of values; after executing a +Inside a generator function, the ``return`` statement when used without a +value signals the end of the procession of values; after executing a ``return`` the generator cannot return any further values. ``return`` with a -value, such as ``return 5``, is a syntax error inside a generator function. The -end of the generator's results can also be indicated by raising -:exc:`StopIteration` manually, or by just letting the flow of execution fall off -the bottom of the function. +value, such as ``return 5``, is semantically equivalent to +``raise StopIteration(value)``. The end of the generator's results can also +be indicated by just letting the flow of execution fall off the bottom of the +function. You could achieve the effect of generators manually by writing your own class and storing all the local variables of the generator as instance variables. For