Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b5d164c

Browse files
committed
Mention types.SimpleNamespace in collections.namedtuple doc
Issue #26805.
1 parent 119ebb7 commit b5d164c

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

Doc/library/collections.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,11 @@ they add the ability to access fields by name instead of position index.
792792
Named tuple instances do not have per-instance dictionaries, so they are
793793
lightweight and require no more memory than regular tuples.
794794

795+
For simple uses, where the only requirement is to be able to refer to a set
796+
of values by name using attribute-style access, the
797+
:class:`types.SimpleNamespace` type can be a suitable alternative to using
798+
a namedtuple.
799+
795800
.. versionchanged:: 3.1
796801
Added support for *rename*.
797802

0 commit comments

Comments
 (0)