Martin Panter added the comment:
Previous discussion: Issue 1722, Issue 11009.
In Python 2, most of the split- functions _have_ been in urllib.__all__ since
revision 5d68afc5227c (2.1). Also, since revision c3656dca65e7 (Issue 1722,
2.7.4), the RST documentation does mention that at least some of them are
deprecated in favour of the “urlparse” module. However there are no index
entries, and splitport() is not mentioned by name.
In Python 3, these functions wandered into urllib.parse. There is no RST
documentation, and the functions are not in __all__ (which was added for Issue
13287 in 3.3).
I think you can use the documented urllib.parse API instead of splitport(), but
it is borderline unwieldy:
>>> netloc = "[::1]:80"
>>> urllib.parse.splitport(netloc) # [Brackets] kept!
('[::1]', '80')
>>> split = urlsplit("//" + netloc); (split.hostname, split.port)
('::1', 80)
>>> split = SplitResult("", netloc, path="", query="", fragment="");
>>> (split.hostname, split.port)
('::1', 80)
I opened Issue 23416 with a suggestion that would make SplitResult a bit
simpler to use here. But maybe it makes the implementation too complicated.
I don’t think the non-split-names (Quoter, etc) are in much doubt. They were
never in __all__.
----------
nosy: +martin.panter
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue27485>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com