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 curioswati
Recipients abarnert, abarry, curioswati, rhettinger
Date 2015-12-17.03:15:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1450322138.83.0.0383321825059.issue25864@psf.upfronthosting.co.za>
In-reply-to
Content
But the work around suggested here as:

def __reversed__(self):
    return (self[k] for k in reversed(range(len(self))))

is also not a general solution, i.e. it is applicable for the following case:
    m = MyDict({2:40, 0:10, 1:20})

but for any other mapping which does not have 0 as a key, it results in KeyError. So another solution, which would be more general could be:

def __reversed__(self):
    keys = [k for k in self.keys()]
    return (self[k] for k in reversed(keys))
History
Date User Action Args
2015-12-17 03:15:38curioswatisetrecipients: + curioswati, rhettinger, abarnert, abarry
2015-12-17 03:15:38curioswatisetmessageid: <1450322138.83.0.0383321825059.issue25864@psf.upfronthosting.co.za>
2015-12-17 03:15:38curioswatilinkissue25864 messages
2015-12-17 03:15:38curioswaticreate