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 martin.panter
Recipients martin.panter, orsenthil, soilandreyes
Date 2015-02-09.02:32:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1423449147.99.0.474556511986.issue22852@psf.upfronthosting.co.za>
In-reply-to
Content
I also liked the idea of returning None to distinguish a missing URL component from an empty-but-present component, and it would make them more consistent with the “username” and “password” fields. But I agree it would break backwards compabitility too much. The idea of “has_fragment” etc flags might work. The ParseResult etc class signatures could be expanded like this:

SplitResult(scheme, netloc, path, query, fragment, *, has_netloc=None, has_query=None, has_fragment=None)

>>> url1 = SplitResult("http", "localhost", "/path", query="", fragment="")
>>> url1.has_netloc
True
>>> url1.has_fragment
False
>>> url2 = SplitResult("http", "localhost", "/path", query="", fragment="", has_fragment=True)
>>> url2.has_fragment
True
>>> url2.has_query
False
>>> url2.geturl()
"http://localhost/path#"

Is it also worth adding “has_params” for urlparse()?
History
Date User Action Args
2015-02-09 02:32:28martin.pantersetrecipients: + martin.panter, orsenthil, soilandreyes
2015-02-09 02:32:27martin.pantersetmessageid: <1423449147.99.0.474556511986.issue22852@psf.upfronthosting.co.za>
2015-02-09 02:32:27martin.panterlinkissue22852 messages
2015-02-09 02:32:27martin.pantercreate