Modern Python 3.x’s can use iterator that has less overhead than constructing a list
.
first_value = next(iter(my_dict.values()))
Note that if the dictionary is empty you will get StopIteration
exception and not None
.
Since Python 3.7+ this is guaranteed to give you the first item.