classification
Title: "Evaluation order" doc section is wrong about dicts
Type: enhancement Stage: resolved
Components: Documentation Versions: Python 3.2, Python 3.3, Python 3.4, Python 2.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Evaluation order of dictionary display is different from reference manual.
View: 11205
Assigned To: ezio.melotti Nosy List: chris.jerdonek, ezio.melotti
Priority: normal Keywords:

Created on 2012-12-25 13:54 by ezio.melotti, last changed 2012-12-25 14:41 by ezio.melotti. This issue is now closed.

Messages (2)
msg178127 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2012-12-25 13:54
http://docs.python.org/2/reference/expressions.html#evaluation-order
says that the dicts are evaluated in this order:
  {expr1: expr2, expr3: expr4}

however each value is evaluated before the respective key:
def f(x):
  print(x)
  return x

{f('k1'): f('v1'), f('k2'): f('v2')}

v1
k1
v2
k2
{'k1': 'v1', 'k2': 'v2'}
msg178129 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2012-12-25 14:41
This has already been reported in #11205.
History
Date User Action Args
2012-12-25 14:41:50ezio.melottisetstatus: open -> closed
superseder: Evaluation order of dictionary display is different from reference manual.
messages: + msg178129

resolution: duplicate
stage: needs patch -> resolved
2012-12-25 13:54:47ezio.melotticreate