Message397037
It is still the same in 3.11:
>>> class WithoutSetItem:
... def __getitem__(self, key):
... return "foo"
...
>>> class WithSetItem:
... def __getitem__(self, key):
... return "foo"
... def __setitem__(self, key, val):
... return
...
>>> wo = WithoutSetItem()
>>> del wo[0]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'WithoutSetItem' object doesn't support item deletion
>>> w = WithSetItem()
>>> del w[0]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: __delitem__
>>> |
|
Date |
User |
Action |
Args |
2021-07-06 13:36:21 | iritkatriel | set | recipients:
+ iritkatriel, rhettinger, r.david.murray, raumzeitkeks, hongweipeng, xtreak |
2021-07-06 13:36:21 | iritkatriel | set | messageid: <1625578581.87.0.845678133965.issue31218@roundup.psfhosted.org> |
2021-07-06 13:36:21 | iritkatriel | link | issue31218 messages |
2021-07-06 13:36:21 | iritkatriel | create | |
|