yield keyword reserved

Simon Burton simonb at webone.com.au
Mon Sep 2 02:18:01 CEST 2002


you forgot this:

>>> from __future__ import generators


On Mon, 02 Sep 2002 01:57:06 +1000, Erik Price wrote:

> 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