generators not working? python 2.2
Mark McEahern
marklists at mceahern.com
Fri Jan 11 13:10:49 EST 2002
More information about the Python-list mailing list
Fri Jan 11 13:10:49 EST 2002
- Previous message (by thread): How do I pass dict as parameterlist in Python 1.52 ?
- Next message (by thread): generators not working? python 2.2
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I tried this simple example from: http://python.sourceforge.net/peps/pep-0255.html and it doesn't seem to work? I'm probably doing something obviously wrong. Please help. $ python Python 2.2 (#1, Dec 31 2001, 15:21:18) [GCC 2.95.3-5 (cygwin special)] on cygwin Type "help", "copyright", "credits" or "license" for more information. >>> from __future__ import generators >>> def fib(): ... a, b = 0, 1 ... while 1: ... yield b ... a, b = b, a + b ... >>> for i in xrange(1, 10): ... print fib().next() ... 1 1 1 1 1 1 1 1 1 Thanks, // mark
- Previous message (by thread): How do I pass dict as parameterlist in Python 1.52 ?
- Next message (by thread): generators not working? python 2.2
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list