[issue33235] Better help text for dict.setdefault
Paddy McCarthy
report at bugs.python.org
Fri Apr 6 06:13:47 EDT 2018
New submission from Paddy McCarthy <paddy3118 at gmail.com>:
Hi, I was answering some question and used dict.setdefault as part of the solution and posted the help() on it as part of my answer.
The help was this:
In [15]: help(mapper.setdefault)
Help on built-in function setdefault:
setdefault(...) method of builtins.dict instance
D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
This seems the wrong way around. Is it not better expressed as
D.setdefault(k[,d]) -> set D[k]=d if k not in D and then D.get(k,d)
----------
assignee: docs at python
components: Documentation
messages: 315015
nosy: Paddy McCarthy, docs at python
priority: normal
severity: normal
status: open
title: Better help text for dict.setdefault
type: enhancement
versions: Python 3.6
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33235>
_______________________________________
More information about the Python-bugs-list
mailing list