You can use an interactive interpreter to explore something like this experimentally.
>>> xshow(None)
Traceback (most recent call last):
File "<pyshell#12>", line 1, in <module>
xshow(None)
File "<pyshell#11>", line 1, in xshow
def xshow(x): print("{[[[[]}".format(x))
TypeError: 'NoneType' object is not subscriptable
>>> xshow([])
Traceback (most recent call last):
File "<pyshell#13>", line 1, in <module>
xshow([])
File "<pyshell#11>", line 1, in xshow
def xshow(x): print("{[[[[]}".format(x))
TypeError: list indices must be integers or slices, not str
>>> xshow({})
Traceback (most recent call last):
File "<pyshell#14>", line 1, in <module>
xshow({})
File "<pyshell#11>", line 1, in xshow
def xshow(x): print("{[[[[]}".format(x))
KeyError: '[[['
>>> xshow({'[[[':1})
1
Now, perhaps read the document.
source
share