Find minimum element in a dictionary of dictionaries
Question: I need to find what element of `apple` has the minimum `size`.

Tnx for all answers. But there is one problem: I use Python 2.4.2 (I can't
change it) and function `min` haven't `key` arg. Yes, I need key of `apple`

    
    
    apple = {1:{'size':12,'color':'red'},2:{'size':10,'color':'green'}}
    


Answer: 
    import operator
    min(apple.values(), key=operator.itemgetter('size'))
    

will return you

    
    
    {'color': 'green', 'size': 10}
    

UPDATE: to get the index:

    
    
    min(apple, key=lambda k: apple[k]['size'])
    

