This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author r.david.murray
Recipients Ivan.Pozdeev, bsaner, r.david.murray
Date 2018-05-13.21:58:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1526248715.95.0.682650639539.issue33480@psf.upfronthosting.co.za>
In-reply-to
Content
These are actually reasonable requests, and in fact have been brought up before and implemented:

>>> x = urlparse('http://me:mypass@example.com:800/foo;key1=value1?key2=value2#key3=value3#key4=value4')
>>> x
ParseResult(scheme='http', netloc='me:mypass@example.com:800', path='/foo', params='key1=value1', query='key2=value2', fragment='key3=value3#key4=value4')
>>> x.hostname
'example.com'
>>> x.port
800
>>> x.username
'me'
>>> x.password
'mypass'
>>> x._asdict()
OrderedDict([('scheme', 'http'), ('netloc', 'me:mypass@example.com:800'), ('path', '/foo'), ('params', 'key1=value1'), ('query', 'key2=value2'), ('fragment', 'key3=value3#key4=value4')])


Now, what this doesn't get you is the "extra" fields that are not part of the base tuple.  The base tuple has the members it does for backward compatibility.  So, the thing to discuss on python-ideas would be an API for namedtuple that gets you the extra fields.

None versus the empty string is not something that can happen, for backward compatibility reasons, even if there was agreement that it was better.

I'm not entirely sure why dict(x) is not supported (but I suspect it is because x is "a tuple", again for backward compatibility reasons), so you might search the archives to find out why for sure, if you  are curious.
History
Date User Action Args
2018-05-13 21:58:35r.david.murraysetrecipients: + r.david.murray, Ivan.Pozdeev, bsaner
2018-05-13 21:58:35r.david.murraysetmessageid: <1526248715.95.0.682650639539.issue33480@psf.upfronthosting.co.za>
2018-05-13 21:58:35r.david.murraylinkissue33480 messages
2018-05-13 21:58:35r.david.murraycreate