Message416369
É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) |
|
Date |
User |
Action |
Args |
2022-03-30 14:54:09 | ethan.furman | set | recipients:
+ ethan.furman, orsenthil, eric.araujo, karlcow, lukasz.langa, lincolnauster |
2022-03-30 14:54:08 | ethan.furman | set | messageid: <1648652048.99.0.973678178876.issue46337@roundup.psfhosted.org> |
2022-03-30 14:54:08 | ethan.furman | link | issue46337 messages |
2022-03-30 14:54:08 | ethan.furman | create | |
|