I came across this strange error that I cannot explain.
Python 2.7.1+ (r271:86832, Apr 11 2011, 18:05:24) [GCC 4.5.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import UserDict >>> a = UserDict.UserDict() >>> b = {} >>> b[a] Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: 'NoneType' object is not callable
I understand that this must be a mistake. I do not understand why it says 'NoneType' object is not callable . As far as I can tell, I am not calling anything on the line that is causing the error.
I expected the error to be something like this:
>>> b[b] Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unhashable type: 'dict'
Can someone explain this to me before I go crazy?
source share