partial sums problem

Seebs usenet-nospam at seebs.net
Wed Sep 29 01:36:01 CEST 2010


On 2010-09-28, Gary Herron <gherron at digipen.edu> wrote:
> Python does have "s+=t" as a statement, and it does have list 
> comprehensions [... for ...] as expressions,  but you cannot put a 
> statement inside an expression.

I've inferred that, in Python, all assignments are by definition
statements, rather than expressions, so they can't be arbitrarily
substituted in for expressions.

It's interesting to see the two ways in which people seem to go
from C's middle ground of expressions and statements; some languages
go to making statements into expressions, others go for even further
narrowing the set of "expressions".  I'm not yet sure which I prefer;
both have some appeal in avoiding some of the occasional-complexity that
can make C hard for people to learn.  (Meaning, complexity which is
only sometimes at issue, so you have to know about it, but you can't just
use it all the time, so you can't assume it's how things work.)

-s
-- 
Copyright 2010, all wrongs reversed.  Peter Seebach / usenet-nospam at seebs.net
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
I am not speaking for my employer, although they do rent some of my opinions.



More information about the Python-list mailing list