RE: syntax error in sum(). Please explicate.

2006-11-19 Thread Delaney, Timothy (Tim)
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

Re: syntax error in sum(). Please explicate.

2006-11-19 Thread Fredrik Lundh
Bjoern Schliessmann wrote: > Are generator comprehensions and generator expressions the same? the documentation uses the word "expression", not comprehension. -- http://mail.python.org/mailman/listinfo/python-list

Re: syntax error in sum(). Please explicate.

2006-11-19 Thread Bjoern Schliessmann
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

Re: syntax error in sum(). Please explicate.

2006-11-18 Thread Tim Peters
[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 a

Re: syntax error in sum(). Please explicate.

2006-11-18 Thread Michael Press
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 --

Re: syntax error in sum(). Please explicate.

2006-11-18 Thread John Machin
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"

Re: syntax error in sum(). Please explicate.

2006-11-18 Thread Paul Rubin
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,

Re: syntax error in sum(). Please explicate.

2006-11-18 Thread 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)) 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 t

Re: syntax error in sum(). Please explicate.

2006-11-18 Thread tom
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. > > ___

syntax error in sum(). Please explicate.

2006-11-18 Thread Michael Press
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. _BEGIN_CODE__