This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

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 2022-04-11 14:57 by admin. 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
2022-04-11 14:57:39adminsetgithub: 60981
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