たまに欲しくなる OrderedDict の先頭か最後のアイテム (ただし非破壊的に)。
順番覚えてるくせにインデクシングできないって何なん?的な。
#先頭のアイテム
>> from collections import OrderedDict
>> od = OrderedDict(((1, 'a'), (2, 'b'), (3, 'c')))
>> od
OrderedDict([(1, 'a'), (2, 'b'), (3, 'c')])
>> next(iter(od))
1
>> next(iter(od.values()))
'a'
>> next(iter(od.items()))
(1, 'a')
#最後のアイテム
>> next(reversed(od))
3
以下略。
ソースは stackoverflow のどこかわすれました。