In Python 3, calling values() on a dict returns dict_values, which does not support the sort method. This leads to the following error under Python 3:
AttributeError: 'dict_values' object has no attribute 'sort'
Additionally, map now returns a generator instead of a list, so the [:] slice syntax doesn't work 🙁:
TypeError: 'map' object is not subscriptable
I addressed this by using itertool's islice function instead.
In Python 3, calling
values()
on adict
returnsdict_values
, which does not support thesort
method. This leads to the following error under Python 3:AttributeError: 'dict_values' object has no attribute 'sort'
Additionally,
map
now returns a generator instead of a list, so the[:]
slice syntax doesn't work 🙁:TypeError: 'map' object is not subscriptable
I addressed this by using itertool's
islice
function instead.