This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author guijarro
Recipients guijarro
Date 2020-08-27.10:28:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1598524100.24.0.553076023684.issue41647@roundup.psfhosted.org>
In-reply-to
Content
Hi,

This is more a question/proposal than a real issue. I apologize in
advance if this has already been debated or if it is not relevant.

I noticed `setdefault` method of mutable mapping objects is returning
the default value as passed in the call, when applicable, without
passing through `__getitem__`.

I think it would be more "symmetric" if it would return the default
value set by `__setitem__` via `__getitem__`. This would handle the
case of a custom MutableMapping defining a custom behaviour of
`__setitem__` and `__getitem__`.

Of course, in my case finally I overloaded `setdefault` to do this,
but it might be worth in general, at least for the MutableMapping
class.

Thanks,
Matias.
History
Date User Action Args
2020-08-27 10:28:20guijarrosetrecipients: + guijarro
2020-08-27 10:28:20guijarrosetmessageid: <1598524100.24.0.553076023684.issue41647@roundup.psfhosted.org>
2020-08-27 10:28:20guijarrolinkissue41647 messages
2020-08-27 10:28:19guijarrocreate