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 for dics key/value
Type: Stage: needs patch
Components: Documentation Versions: Python 3.2, Python 3.3, Python 2.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Evaluation order of dictionary display is different from reference manual.
View: 11205
Assigned To: docs@python Nosy List: amaury.forgeotdarc, docs@python, sandro.tosi
Priority: normal Keywords:

Created on 2012-01-07 16:05 by sandro.tosi, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (2)
msg150804 - (view) Author: Sandro Tosi (sandro.tosi) * (Python committer) Date: 2012-01-07 16:05
Hello, following up http://mail.python.org/pipermail/docs/2011-December/006782.html , I'm opening this issue to have others confirmation of what's happening:

echo -e "def ev(r):\n    print(r)\n    return r\n\n{ev(1): ev(2), ev(3): ev(4)}" | ./python 
2
1
4
3

(this applies for 2.7/3.2/default) so it seems the value expressions are evaluated before the key expressions, so the

{expr1: expr2, expr3: expr4}

in http://docs.python.org/reference/expressions.html#evaluation-order has to be updated in

{expr2: expr1, expr4: expr3}

Is that correct/can someone confirm this is the expected behavior?
msg150972 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2012-01-09 20:02
This is a duplicate of issue11205.
History
Date User Action Args
2022-04-11 14:57:25adminsetgithub: 57938
2012-01-09 20:02:42amaury.forgeotdarcsetstatus: open -> closed

nosy: + amaury.forgeotdarc
messages: + msg150972

superseder: Evaluation order of dictionary display is different from reference manual.
resolution: duplicate
2012-01-07 16:05:31sandro.tosicreate