[New-bugs-announce] [issue13729] Evaluation order for dics key/value

Sandro Tosi report at bugs.python.org
Sat Jan 7 17:05:32 CET 2012


New submission from Sandro Tosi <sandro.tosi at gmail.com>:

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?

----------
assignee: docs at python
components: Documentation
messages: 150804
nosy: docs at python, sandro.tosi
priority: normal
severity: normal
stage: needs patch
status: open
title: Evaluation order for dics key/value
versions: Python 2.7, Python 3.2, Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13729>
_______________________________________


More information about the New-bugs-announce mailing list