As it stands with urllib.parse, even a small change to an URL requires multiple lines of code that resemble the actual required change very little because the parsing and unparsing are most prominent.
This is an approach to a design for an URL class we could improve on and adapt for inclusion into the standard library:
I didn’t mean to promote furl (nor yarl), but to take the ideas and include an URL class as part of urllib.
Note that furl (don’t know if yarl) states it supports base_url / path_component.
I should have given more arguments for the proposal for URL.
Basically, newcomers to things about the Web will almost always do “string arithmetic” (split(), join(), +, etc.) over URLs, and that is always risky, and often wrong.
A pathlib.Path-like class in urlib.URL would almost certainly make the above go away in time (and make the Python-run Web a safer place too).
This makes it somewhat unclear how much effort we should be putting into it.
We’ll even be shipping a better URL parser as part of the stdlib soon, albeit not where users can see it – pip vendors urllib3, and urllib3 recently started vendoring the rfc3986 package.