Message291868
| Author |
serhiy.storchaka |
| Recipients |
donkopotamus, fdrake, pitrou, rhettinger, serhiy.storchaka, stutzbach |
| Date |
2017年04月19日.09:41:08 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1492594868.33.0.660593340663.issue30100@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
dict.pop() supports unhashable values, but dict.__contains__() and dict.get() don't:
>>> [] in {}
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unhashable type: 'list'
>>> {}.get([], 42)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unhashable type: 'list'
>>> {}.pop([], 42)
42
OrderedDict.pop() also doesn't support unhashable values:
>>> collections.OrderedDict().pop([], 42)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unhashable type: 'list' |
|