yield keyword reserved

Erik Price erikprice at mac.com
Sun Sep 1 11:57:06 EDT 2002


I'm sorry if this is an easily answered-question.  I have Python2.2 
running on my system (it is installed on Darwin by default in Mac OS X 
10.2), and am learning about iterators from 
<http://python.org/doc/current/whatsnew/node5.html>, but the keyword 
doesn't appear to be present on my system:

Python 2.2 (#1, 07/14/02, 23:25:09)
[GCC Apple cpp-precomp 6.14] on darwin
Type "help", "copyright", "credits" or "license" for more information.
 >>> def generate_ints(N):
...  for i in range(N):
...   yield i
<string>:3: Warning: 'yield' will become a reserved keyword in the 
future
   File "<string>", line 3
     yield i
           ^
SyntaxError: invalid syntax
 >>>


Is my Python not a true 2.2 release, or do I have something wrong in my 
syntax?
For that matter a recompile wouldn't be so bad since this build doesn't 
have readline :(


Erik






--
Erik Price

email: erikprice at mac.com
jabber: erikprice at jabber.org





More information about the Python-list mailing list