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.

Author ezio.melotti
Recipients benjamin.peterson, eric.araujo, ezio.melotti, georg.brandl, gvanrossum, ncoghlan, r.david.murray, rhettinger, sandro.tosi, swamiyeswanth, takayuki, terry.reedy
Date 2012-12-25.14:58:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1356447529.89.0.102940178431.issue11205@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2012-12-25 14:58:50ezio.melottisetrecipients: + ezio.melotti, gvanrossum, georg.brandl, rhettinger, terry.reedy, ncoghlan, benjamin.peterson, eric.araujo, r.david.murray, sandro.tosi, swamiyeswanth, takayuki
2012-12-25 14:58:49ezio.melottisetmessageid: <1356447529.89.0.102940178431.issue11205@psf.upfronthosting.co.za>
2012-12-25 14:58:49ezio.melottilinkissue11205 messages
2012-12-25 14:58:49ezio.melotticreate