[docs] documentation error w/ evaluation order (original) (raw)
Zach Wegner zwegner at gmail.com
Fri Dec 16 04:03:38 CET 2011
- Previous message: [docs] [issue13604] update PEP 393 (match implementation)
- Next message: [docs] [issue11379] Remove "lightweight" from minidom description
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
In http://docs.python.org/reference/expressions.html#evaluation-order, there's a table that contains this entry, giving the order of evaluation for dict literals:
{expr1: expr2, expr3: expr4}
However, for each item, the value is evaluated before the key, like so:
def ev(r): print(r) return r
{ev(1): ev(2), ev(3): ev(4)}
prints (under 3.2.2):
2 1 4 3
Thanks, Zach
- Previous message: [docs] [issue13604] update PEP 393 (match implementation)
- Next message: [docs] [issue11379] Remove "lightweight" from minidom description
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]