Jörn Hees added the comment: It's been a while... nowadays I would mostly change the documentation of the quote function to point out that it is likely to quote more characters than absolutely necessary by SPEC. The function is in place for so long, (even in py3) that people will rely on the behavior.
I made an attempt to update the docstring accordingly in https://github.com/python/cpython/pull/2568 What i think is most confusing is the current docs mentioning the reserved chars (which are btw. definitely wrong wrt. RFC3986). Actually as one can see in the code the reserved chars don't play any role for quote, but much more the unreserved chars (called _ALWAYS_SAFE https://github.com/python/cpython/blob/master/Lib/urllib/parse.py#L716 ). unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" The current quote function's approach is to simply quote everything that is not in unreserved + safe (per arg). In that aspect it is quite close to the old javascript.escape function: https://www.w3schools.com/jsref/jsref_escape.asp quick links py2.7: https://github.com/python/cpython/blob/2.7/Lib/urllib.py#L1261 py3: https://github.com/python/cpython/blob/master/Lib/urllib/parse.py#L745 RFC3986: https://tools.ietf.org/html/rfc3986#appendix-A ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue12910> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com