Why does myDictionary.values()
return a dict_values
object as opposed to a set
or list
or tuple
?
I don't see the advantage to the dict_values
type and it causes issues when casting to other types, e.g.:
>>> np.array( {0: 0, 1: 1}.values() )
array(dict_values([0, 1]), dtype=object)
>>> np.array( list( {0: 0, 1: 1}.values() ) )
array([0, 1])
Why did Python's .values()
go from using the more-compatible lists in Python 2 to returning its own custom object in Python 3?