Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #32249
| References | <CABicbJJkbK4fop0GSb2bofMu1_6X0vVgku4bo1O51b63S0A5ZQ@mail.gmail.com> <20121026235601.GA32598@cskk.homeip.net> |
|---|---|
| From | Devin Jeanpierre <jeanpierreda@gmail.com> |
| Date | 2012-10-26 19:59 -0400 |
| Subject | Re: while expression feature proposal |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2920.1351295989.27098.python-list@python.org> (permalink) |
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
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: while expression feature proposal Devin Jeanpierre <jeanpierreda@gmail.com> - 2012-10-26 19:59 -0400
csiph-web