while expression feature proposal
Devin Jeanpierre
jeanpierreda at gmail.com
Fri Oct 26 19:59:06 EDT 2012
On Fri, Oct 26, 2012 at 7:56 PM, Cameron Simpson <cs at zip.com.au> wrote:
> No. Separate _expressions_ are evaluated left to right.
>
> So this:
>
> f(1), f(2)
>
> calls "f(1)" first, then "f(2)". But this:
>
> f(1) + f(2)
>
> need not do so. Counter-documentation welcomed, but the doco you cite
> does not define an order for the second example above.
Actually, it does. Both f(1) and f(2) are separate (sub-)expressions
in f(1) + f(2). More to the point, it gives the following example:
In the following lines, expressions will be evaluated in the
arithmetic order of their suffixes:
...
expr1 + expr2 * (expr3 - expr4)
I sympathize with your concern, though. Order of evaluation is very
bitey, and it's better to be safe than sorry.
-- Devin
More information about the Python-list
mailing list