Message256437
| Author |
curioswati |
| Recipients |
abarnert, abarry, curioswati |
| Date |
2015年12月15日.04:44:20 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1450154661.27.0.259451194217.issue25864@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
> If you do `reversed(d)`, you get a nice `TypeError: argument to reversed() must be a sequence`. But if you do `reversed(m)`, you get a reversed` iterator. And when you iterate it, presumably expecting to get 0 and 1 in some arbitrary order, you instead get 3, and then a KeyError:0`.
I got 2 instead of 3.
What are we exactly expecting here? How can a dictionary be reversed?
> I can't imagine this would break any working code. If it did, the workaround would be simple: just implement `def __reversed__(self): return (self[k] for k in reversed(range(len(self))))`.
This seems to make no difference. I still got the KeyError. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2015年12月15日 04:44:21 | curioswati | set | recipients:
+ curioswati, abarnert, abarry |
| 2015年12月15日 04:44:21 | curioswati | set | messageid: <1450154661.27.0.259451194217.issue25864@psf.upfronthosting.co.za> |
| 2015年12月15日 04:44:21 | curioswati | link | issue25864 messages |
| 2015年12月15日 04:44:20 | curioswati | create |
|