Swati Jaiswal added the comment:

> 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.

----------

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

Reply via email to