Python: why a dictionary type data could automatically exclude some items?

Viewed 59

I created a dictionary containing six items as below:

 >>> dict1 = {
'A': ['A','A'],
'AB':['A','B'], 
'A':['A','O'],
'B':['B','B'],
'B':['B','O'],
'O':['O','O']
}

But when I check the dictionary I found that the items "{'A': ['A', 'A'], 'B': ['B', 'B']}" have been excluded.

>>> dict1
Out[19]: {'A': ['A', 'O'], 'AB': ['A', 'B'], 'B': ['B', 'O'], 'O': ['O', 'O']}
>>> len(dict1)
Out[17]: 4

However if I create a new dictionary with the excluded items.It becomes normal.

>>> dict2 ={'A': ['A', 'A'], 'B': ['B', 'B']}
>>> dict2
Out[21]: {'A': ['A', 'A'], 'B': ['B', 'B']}

Could anybody explain me why is that?

4 Answers
Related