Ethan Furman <et...@stoneleaf.us> added the comment: É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) ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue46337> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com