Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #32249 > unrolled thread

Re: while expression feature proposal

Started byDevin Jeanpierre <jeanpierreda@gmail.com>
First post2012-10-26 19:59 -0400
Last post2012-10-26 19:59 -0400
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: while expression feature proposal Devin Jeanpierre <jeanpierreda@gmail.com> - 2012-10-26 19:59 -0400

#32249 — Re: while expression feature proposal

FromDevin Jeanpierre <jeanpierreda@gmail.com>
Date2012-10-26 19:59 -0400
SubjectRe: while expression feature proposal
Message-ID<mailman.2920.1351295989.27098.python-list@python.org>
On Fri, Oct 26, 2012 at 7:56 PM, Cameron Simpson <cs@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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web