Paul Rubin wrote:
Generator comprehensions
Are generator comprehensions and generator expressions the same?
Regards,
Björn
--
BOFH excuse #35:
working as designed
--
http://mail.python.org/mailman/listinfo/python-list
Bjoern Schliessmann wrote:
Are generator comprehensions and generator expressions the same?
the documentation uses the word expression, not comprehension.
/F
--
http://mail.python.org/mailman/listinfo/python-list
John Machin wrote:
Michael Press wrote:
I have not written python codes nor run any. I saw this
code posted and decided to try it. It fails. I read the
tutorial and the entry for the built in function sum,
but still do not see the problem. The code was cut and
paste.
I doubt it -- none
Michael Press wrote:
I have not written python codes nor run any. I saw this
code posted and decided to try it. It fails. I read the
tutorial and the entry for the built in function sum,
but still do not see the problem. The code was cut and
paste. Please help. Thanks.
try surrounding your sum argument in brackets:
sum([phi(x // ps[i+1], i) for i in range(a)])
instead of:
sum(phi(x // ps[i+1], i) for i in range(a))
On Nov 18, 5:23 pm, Michael Press [EMAIL PROTECTED] wrote:
I have not written python codes nor run any. I saw this
code posted and decided to
Michael Press [EMAIL PROTECTED] 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
Michael Press wrote:
I have not written python codes nor run any. I saw this
code posted and decided to try it. It fails. I read the
tutorial and the entry for the built in function sum,
but still do not see the problem. The code was cut and
paste.
I doubt it -- none should be None
Please
In article
[EMAIL PROTECTED]
,
Matt Moriarity [EMAIL PROTECTED] wrote:
try surrounding your sum argument in brackets:
sum([phi(x // ps[i+1], i) for i in range(a)])
instead of:
sum(phi(x // ps[i+1], i) for i in range(a))
Thank you. That makes it work.
--
Michael Press
--
[Matt Moriarity]
try surrounding your sum argument in brackets:
sum([phi(x // ps[i+1], i) for i in range(a)])
instead of:
sum(phi(x // ps[i+1], i) for i in range(a))
[Michael Press]
Thank you. That makes it work.
But is a wrong solution ;-) As others have suggested, it's almost