[issue31218] del expects __delitem__ if __setitem__ is defined

2021-07-08 Thread Raymond Hettinger
Raymond Hettinger added the comment: I'm closing this as not being worth changing. It is only a minor irritant and arguably not a bug. "Fixing it" would be disruptive and likely not help anyone. -- resolution: -> wont fix stage: -> resolved status: open -> closed

[issue31218] del expects __delitem__ if __setitem__ is defined

2021-07-06 Thread Irit Katriel
Irit Katriel added the comment: 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): ...

[issue31218] del expects __delitem__ if __setitem__ is defined

2018-10-16 Thread Raymond Hettinger
Raymond Hettinger added the comment: This is likely an implementation artifact. In the abstract API, both PyObject_DelItem() and PyObject_SetItem() route through the same slot, m->mp_ass_subscript. The set and delete operations are only differentiated in the downstream concrete APIs.

[issue31218] del expects __delitem__ if __setitem__ is defined

2018-10-16 Thread hongweipeng
Change by hongweipeng : -- nosy: +hongweipeng ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue31218] del expects __delitem__ if __setitem__ is defined

2018-09-22 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +xtreak ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue31218] del expects __delitem__ if __setitem__ is defined

2017-08-16 Thread R. David Murray
R. David Murray added the comment: I'm not sure we would consider this a bug (the message is accurate), but I wouldn't object to fixing it, since that would indeed seem more consistent with how __delitem__ and del are defined in the language reference. -- nosy: +r.david.murray

[issue31218] del expects __delitem__ if __setitem__ is defined

2017-08-16 Thread Calvin
New submission from Calvin: I noticed some odd behaviour on classes defining __setitem__. Using del on a class defining __setitem__ but not __delitem__ results in "AttributeError: __delitem__". On classes definig neiter __setitem__ nor __delitem__ on the other hand this results in "TypeError: