classification
Title: Document that SplitResult & friends are namedtuples
Type: Stage: resolved
Components: Documentation Versions: Python 3.6, Python 3.5
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Document that urllib.parse.{Defrag,Split,Parse}Result are namedtuples
View: 31822
Assigned To: rhettinger Nosy List: docs@python, kmike, martin.panter, rhettinger
Priority: normal Keywords:

Created on 2016-07-07 23:42 by kmike, last changed 2019-03-23 00:17 by martin.panter. This issue is now closed.

Messages (3)
msg269964 - (view) Author: Mikhail Korobov (kmike) Date: 2016-07-07 23:42
Docs currently say that urllib.parse.SplitResult is a subclass of tuple, without saying that it is namedtuple. What do you think about documenting it as a namedtuple? It has an useful _replace method which allows to change some part of URL before passing it to urlunsplit.

It may also require updating typeshed - I noticed this issue because mypy shows an error when SplitResult._replace is used.
msg270150 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-07-11 01:30
I agree, SplitResult._replace() would probably have been very useful to me in the past if it were available (and guaranteed by the documentation).

The namedtuple implementation was added in revision 79579fa8d752 (in 2.6 and 3.0), with a comment mentioning speeding up and simplifying the code. So it may not have originally been intended to have the namedtuple functionality as part of the API.

If the change is made in 3.5, it should equally be made in 2.7 (with a notice about only being supported since 2.6).
msg338632 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2019-03-23 00:17
Suggest merging this with Issue 31822, which seems to have more progress, and where Raymond also seems to be involed.
History
Date User Action Args
2019-03-23 00:17:59martin.pantersetstatus: open -> closed
superseder: Document that urllib.parse.{Defrag,Split,Parse}Result are namedtuples
messages: + msg338632

resolution: duplicate
stage: needs patch -> resolved
2016-07-11 18:07:32rhettingersetassignee: docs@python -> rhettinger
2016-07-11 01:30:47martin.pantersetnosy: + rhettinger, martin.panter
messages: + msg270150
2016-07-08 08:32:39SilentGhostsetversions: + Python 3.5, Python 3.6
nosy: + docs@python

assignee: docs@python
components: + Documentation
stage: needs patch
2016-07-07 23:42:36kmikecreate