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 ethan.furman
Recipients eric.araujo, ethan.furman, karlcow, lincolnauster, lukasz.langa, orsenthil
Date 2022-03-30.14:54:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1648652048.99.0.973678178876.issue46337@roundup.psfhosted.org>
In-reply-to
Content
Éric Araujo wrote on PR30520:
----------------------------
> No, we should not redefine the behavior of urlparse.
> 
> I was always talking about adding another function. Yes it can be a one-liner,
> but my point is that I don’t see the usefulness of having the separate flags to
> pick and choose parts of standard parsing.

I suspect the usefulness comes from error checking -- if a scheme doesn't support parameters, then having what looks like parameters converted would not be helpful.

Further, while a new function is definitely safer, how many parse options do we need?  Anyone else remember `os.popen()`, `os.popen2`, `os.popen3`, and, finally, `os.popen4()`?

Assuming we just enhance the existing function, would it be more palatable if there was a `SchemeFlag.ALL`, so universal parsing was just `urlparse(uri_string, flags=SchemeFlag.ALL)`?  To be really user-friendly, we could have:

    class SchemeFlag(Flag):
        RELATIVE = auto()
        NETLOC = auto()
        PARAMS = auto()
        UNIVERSAL = RELATIVE | NETLOC | PARAMS
        #
        def __repr__(self):
            return f"{self.module}.{self._name_}"
        __str__ = __repr__
    RELATIVE, NETLOC, PARAMS, UNIVERSAL = SchemeFlag

Then the above call becomes:

    urlparse(uri_string, flags=UNIVERSAL)
History
Date User Action Args
2022-03-30 14:54:09ethan.furmansetrecipients: + ethan.furman, orsenthil, eric.araujo, karlcow, lukasz.langa, lincolnauster
2022-03-30 14:54:08ethan.furmansetmessageid: <1648652048.99.0.973678178876.issue46337@roundup.psfhosted.org>
2022-03-30 14:54:08ethan.furmanlinkissue46337 messages
2022-03-30 14:54:08ethan.furmancreate