New submission from Paddy McCarthy <paddy3...@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@python
components: Documentation
messages: 315015
nosy: Paddy McCarthy, docs@python
priority: normal
severity: normal
status: open
title: Better help text for dict.setdefault
type: enhancement
versions: Python 3.6

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33235>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to