Message291867
What about difference_update(), issubset(), issuperset(), __eq__()?
Raising TypeError looks reasonable to me. Operations with ordinal sets can raise TypeError for unhashable values.
>>> [] in set()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unhashable type: 'list'
>>> set().remove([])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unhashable type: 'list'
>>> set().discard([])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unhashable type: 'list'
Unlike to set.__contains__ WeakSet.__contains__ returns False for unsupported types:
>>> [] in weakref.WeakSet()
False
Shouldn't set.__contains__ be changed to return False for unhashable values? Or may be make WeakSet.__contains__ raising TypeError for values that can't have weak references? |
|
Date |
User |
Action |
Args |
2017-04-19 08:30:53 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, fdrake, rhettinger, pitrou, stutzbach, donkopotamus |
2017-04-19 08:30:53 | serhiy.storchaka | set | messageid: <1492590653.65.0.763316100783.issue30100@psf.upfronthosting.co.za> |
2017-04-19 08:30:53 | serhiy.storchaka | link | issue30100 messages |
2017-04-19 08:30:53 | serhiy.storchaka | create | |
|