Le 08/04/2011 18:43, Ian Kelly a écrit :
"x=42" is an assignment statement, not an expression.
Right, I was confounding with C ;)
In fact, respect to this question, the documentation makes things
unambiguous :
-----------------
In contrast to many other languages, not all language constructs are
expressions. There are also statements which cannot be used as
expressions, such as print or if. Assignments are also statements, not
expressions.
-----------------
In "bool(x=5)", "x=5" is also not an expression. It's passing the
expression "5" in as the parameter x, using a keyword argument.
You are probably right but how do you deduce this brilliant
interpretation from the wording given in the documentation ?
--
http://mail.python.org/mailman/listinfo/python-list