Neat way of popping key, value PAIR from dictionary?
问题 pop is a great little function that, when used on dictionaries (given a known key) removes the item with that key from the dictionary and also returns the corresponding value. But what if I want the key as well? Obviously, in simple cases I could probably just do something like this: pair = (key, some_dict.pop(key)) But if, say, I wanted to pop the key-value pair with the lowest value, following the above idea I would have to do this... pair = (min(some_dict, key=some.get), some_dict.pop(min