Ezio Melotti added the comment:

I came across the same problem in #16777.

IMHO the current behavior is better, and the documentation should be fixed 
instead, for the following reasons:
 1) it's consistent with assignments, where the RHS is evaluated before the LHS 
(see also msg128500).  This should also be the behavior of the dict(k=v) 
syntax, and what I personally expect;
 2) changing it back is not backward-compatible with any code written during 
the last 10 years;
 3) keeping the current behavior and fixing the docs is simpler than fixing the 
code to match the docs;

In addition, I would avoid writing code with side-effects in a dict literal, 
even if the order was documented and guaranteed.  The fact that we don't see 
many reports about this seems to indicate that people don't write such code, or 
if they do they rely on the current order.

----------
nosy: +ezio.melotti, gvanrossum
type:  -> behavior

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue11205>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to