Pythonic way to access arbitrary element from dictionary
Avoiding the whole values
/itervalues
/viewvalues
mess, this works equally well in Python2 or Python3
dictionary[next(iter(dictionary))]
alternatively if you prefer generator expressions
next(dictionary[x] for x in dictionary)
Similar to your second solution, but slightly more obvious, in my opinion:
return next(iter(dictionary.values()))
This works in python 2 as well as in python 3, but in python 2 it's more efficient to do it like this:
return next(dictionary.itervalues())