So, I know that this,
a = {} # dict
constructs an empty dictionary. Now, I also picked up that this,
b = {1, 2, 3} # set
creates a set. This can easily be verified, as,
>>>print(type(a))
<class 'dict'>
>>>print(type(b))
<class 'set'>
While I understand what it does, I fail to see why we use 'set notation' for empty dictionaries. I tried to find some more information about the logic behind this in the set
and dict
sections of the manual, but sadly, I got nothing out of it.
Could anyone explain to me why we do this in this way? Is it for historical reasons, or am I missing something blatantly obvious?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…