The conditional expression documentation says: conditional_expression ::= or_test ["if" or_test "else" expression] I've stared at this and the PEP, and I''m pretty sure that the first or_test should be an expression, not an or_test. In an expression like "x if C else y", x and y are expressions and C is the or_test. The documentation in question is at http://docs.python.org/reference/expressions.html#conditionalexpressions Ken
BEGIN PGP SIGNED MESSAGE Hash: SHA1 Am 03.06.2010 06:08, schrieb Ken Shirriff:
The conditional expression documentation says:
conditional_expression ::= or_test ["if" or_test "else" expression]
I've stared at this and the PEP, and I''m pretty sure that the first or_test should be an expression, not an or_test. In an expression like "x if C else y", x and y are expressions and C is the or_test.
The documentation in question is at http://docs.python.org/reference/expressions.html#conditionalexpressions
Hi Ken, Even if its name may be unfortunate, "or_test" is the correct symbol in this case; it means that you can write ``a or b if c or d else e`` (course, this is close to unreadable). regards, Georg BEGIN PGP SIGNATURE Version: GnuPG v2.0.15 (GNU/Linux) iEYEARECAAYFAkwTKD4ACgkQN9GcIYhpnLCY9gCfeFvGgvPi9F1lbGB0lCI0B3OZ HE8AoJDzL8ODbJgvMlKYRwcK9Ed9E08I =/1zl END PGP SIGNATURE
participants (2)

Georg Brandl

Ken Shirriff