[docs] Documentation error for conditional expressions?

Georg Brandl georg at python.org
Sat Jun 12 08:25:03 CEST 2010


-----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#conditional-expressions

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-----


More information about the docs mailing list