Look at this:
>>> import bisect
>>> bisect.bisect({}, None)
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
bisect.bisect({}, None)
TypeError: object of type 'dict' has no len()
Of course, objects of type 'dict' do have len. The problem is that bisect considers its first argument a sequence, which is very sensible to do (although, with ordered dicts, it's not the only sensible choice), but it gives a very wrong error message given that context.
At https://bugs.python.org/issue32500, R. David Murray told me to open this. |