On Thu, 13 Nov 2008 10:58:49 -0800 (PST), rurpy@yahoo.com wrote:
Surprise - generators are objects.
Jean-Paul
>On Nov 13, 11:32 am, "J. Cliff Dyer" <j...@sdf.lones tar.orgwrote:
[snip]
>>
>Preserving state is what *objects* are for.
>
>Not exclusively, generators also preserve state.
>
>def _spam():
count = 1
while 1:
yield "spam " * count
count += 1
>spam = _spam.next()
>
>On Thu, 2008-11-13 at 09:38 -0800, Matimus wrote:
Preserving state is what classes are for.
>Preserving state is what *objects* are for.
>Not exclusively, generators also preserve state.
>
>def _spam():
count = 1
while 1:
yield "spam " * count
count += 1
>spam = _spam.next()
>
Jean-Paul
Comment