[issue17327] Add PyDict_GetItemSetDefault() as C-API for dict.setdefault()

Stefan Behnel report at bugs.python.org
Thu Mar 7 20:06:54 CET 2013


Stefan Behnel added the comment:

I had originally considered that name. However, what it really does is PyDict_GetItem(). In a specific special case, it sets a default value and *then* returns that. So it's still PyDict_GetItem(), just with a preceding modification. Also, the interface mimics PyDict_GetItem(). Its primary interface is a getter, not a setter.

I really think that PyDict_SetDefault() is an inappropriate name.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17327>
_______________________________________


More information about the Python-bugs-list mailing list