Message315015
| Author | Paddy McCarthy |
|---|---|
| Recipients | Paddy McCarthy, docs@python |
| Date | 2018-04-06.10:13:47 |
| SpamBayes Score | -1.0 |
| Marked as misclassified | Yes |
| Message-id | <1523009627.66.0.682650639539.issue33235@psf.upfronthosting.co.za> |
| In-reply-to |
| Content | |
|---|---|
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) |
|
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2018-04-06 10:13:47 | Paddy McCarthy | set | recipients: + Paddy McCarthy, docs@python |
| 2018-04-06 10:13:47 | Paddy McCarthy | set | messageid: <1523009627.66.0.682650639539.issue33235@psf.upfronthosting.co.za> |
| 2018-04-06 10:13:47 | Paddy McCarthy | link | issue33235 messages |
| 2018-04-06 10:13:47 | Paddy McCarthy | create | |