syntax error in sum(). Please explicate.

Paul Rubin http
Sat Nov 18 23:39:48 CET 2006


Michael Press <jack at abc.net> writes:
>   File "/Users/mdp/source/prime_counter_python", line 6
>     return x - sum(phi(x // ps[i+1], i) for i in range(a))
>                                           ^
> SyntaxError: invalid syntax
> 
> Here are some lines from python -v:
> 
> Python 2.3 (#1, Sep 13 2003, 00:49:11) 

Generator comprehensions like you used weren't introduced til 
Python 2.4, so 2.3 will raise a syntax error like you got.



More information about the Python-list mailing list