Apologies if this doesn't make any sense, I'm very new to Python!
From testing in an interpreter, I can see that list()
and []
both produce an empty list:
>>> list()
[]
>>> []
[]
From what I've learned so far, the only way to create an object is to call its constructor (__init__
), but I don't see this happening when I just type []
. So by executing []
, is Python then mapping that to a call to list()
?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…