Martin Panter added the comment: In the python-dev thread, Nick Coghlan gave some arguments and examples where PyObject_SetAttr() is intended to be used for deletion. So I will keep my changes for PyObject_SetAttr(), and also _SetAttrString() for consistency. My second patch documents deletion with sq_ass_item(), mp_ass_subscript(), and PySequence_SetItem(). PyObject_SetItem() does not look like it deletes items. It explicitly considers value == NULL to be an error. As a consequence, PyMapping_SetItemString() does not delete either. PySequence_SetItem() does accept NULL to delete the item. I think this is reasonable, to keep it consistent with sq_ass_item(), so I documented it. PySequence_SetSlice() also accepts NULL to delete the slice. But I am more reluctant to document this, because I don’t know of any slot or other code that would benefit. So I have left it as is for the time being. ---------- Added file: http://bugs.python.org/file41194/setattr.2.patch _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue25701> _______________________________________