code review
Devin Jeanpierre
jeanpierreda at gmail.com
Sun Jul 1 21:50:29 EDT 2012
On Sun, Jul 1, 2012 at 9:28 PM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> Technically, < in Python is left-associative: a < b < c first evaluates
> a, not b or c. But it is left-associative under the rules of comparison
> operator chaining, not arithmetic operator chaining.
Left-associativity is when a < b < c is equivalent to (a < b) < c.
You're talking about evaluation order, which can be different. For
example, hypothetically, (a < b) < c could evaluate c first, then b,
then a. However, Python always evaluates operands left-to-right.
A particular case where this comes into play is the ** operator, which
is right-associative but still has a left-to-right evaluation order.
-- Devin
More information about the Python-list
mailing list