classification
Title: Mention SimpleNamespace in namedtuple docs
Type: enhancement Stage:
Components: Documentation Versions: Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: akira, cvrebert, docs@python, python-dev, r.david.murray, rhettinger, scoder
Priority: low Keywords:

Created on 2015-08-11 04:17 by cvrebert, last changed 2015-08-16 15:32 by rhettinger. This issue is now closed.

Messages (6)
msg248389 - (view) Author: Chris Rebert (cvrebert) * Date: 2015-08-11 04:17
There is a cross-reference to namedtuple in SimpleNamespace's docs, but not vice-versa, despite these types being fairly similar.
msg248393 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2015-08-11 06:13
The NT docs are already very long and I don't think an additional crossref is beneficial (NTs are closer to tuples and SNs are closer to dicts).   Also, the uptake for SNs are nearly zero.
msg248395 - (view) Author: Stefan Behnel (scoder) * (Python committer) Date: 2015-08-11 06:35
> Also, the uptake for SNs are nearly zero.

That suggests to me that pointing users to it could help. It's currently hidden in the types module and if I didn't know it existed, I could end up looking in collections, and failing to find it there, write my own.
msg248409 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2015-08-11 15:02
I use SimpleNamespace in just about every project I'm currently working on.  I would *not* say that their uptake is "nearly zero" :)

And yes, I wouldn't be aware of it if I hadn't been following python-dev when it was introduced, and had (before it was introduced) written my own variations numerous times.
msg248683 - (view) Author: Akira Li (akira) * Date: 2015-08-16 15:07
People do have problems that SimpleNamespace can solve:

- Why Python does not support record type i.e. mutable namedtuple [1]
- Does Python have anonymous classes? [2]
- How to create inline objects with properties in Python? [3]
- python create object and add attributes to it [4]

[1] http://stackoverflow.com/questions/5227839/why-python-does-not-support-record-type-i-e-mutable-namedtuple
[2] http://stackoverflow.com/questions/1123000/does-python-have-anonymous-classes
[3] http://stackoverflow.com/questions/1528932/how-to-create-inline-objects-with-properties-in-python
[4] http://stackoverflow.com/questions/2827623/python-create-object-and-add-attributes-to-it
msg248684 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-08-16 15:32
New changeset 678d93c273de by Raymond Hettinger in branch 'default':
Issue #24842:  Cross-reference types.SimpleNamespace from the namedtuple docs
https://hg.python.org/cpython/rev/678d93c273de
History
Date User Action Args
2015-08-16 15:32:46rhettingersetstatus: open -> closed
resolution: fixed
2015-08-16 15:32:18python-devsetnosy: + python-dev
messages: + msg248684
2015-08-16 15:07:07akirasetnosy: + akira
messages: + msg248683
2015-08-11 15:02:30r.david.murraysetnosy: + r.david.murray
messages: + msg248409
2015-08-11 06:35:10scodersetnosy: + scoder
messages: + msg248395
2015-08-11 06:13:33rhettingersetmessages: + msg248393
2015-08-11 04:40:33serhiy.storchakasetpriority: normal -> low
assignee: docs@python -> rhettinger

nosy: + rhettinger
2015-08-11 04:17:28cvrebertcreate