Message315832
The current discrepancy is odd when you compare it to the equivalent generator expression:
{k:v for k, v in iterable}
dict(((k, v) for k, v in iterable))
It would never have occurred to me to expect the evaluation order to match a fully unrolled loop with a nested "d[k] = v" assignment, because the dict constructor doesn't work that way - it accepts an iterable of 2-tuples.
PEP 274 also specifies the iterable-of-2-tuples interpretation (using a list comprehension as its baseline rather than a generator expression): https://www.python.org/dev/peps/pep-0274/#semantics |
|
Date |
User |
Action |
Args |
2018-04-27 10:01:37 | ncoghlan | set | recipients:
+ ncoghlan, rhettinger, xiang.zhang, Jim Fasarakis-Hilliard, EvKounis |
2018-04-27 10:01:37 | ncoghlan | set | messageid: <1524823297.5.0.682650639539.issue29652@psf.upfronthosting.co.za> |
2018-04-27 10:01:37 | ncoghlan | link | issue29652 messages |
2018-04-27 10:01:37 | ncoghlan | create | |
|