Skip to content

urllib.parse - quote/unquote documentation issues #133930

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mohmad-null opened this issue May 12, 2025 · 2 comments
Open

urllib.parse - quote/unquote documentation issues #133930

mohmad-null opened this issue May 12, 2025 · 2 comments
Labels
docs Documentation in the Doc dir

Comments

@mohmad-null
Copy link

https://docs.python.org/3/library/urllib.parse.html

  1. It's my understanding that the arguement in the displayed usage shows the default. So:
    urllib.parse.quote(string, safe='/', encoding=None, errors=None)
    means that errors defaults to NoneType, however, the documentation just below that says:

"errors defaults to 'strict'

  1. quote: There isn't a list of possible values for the "errors" argument

  2. unquote - There isn't a list of possible values for the "errors" argument

  3. unquote -

errors defaults to 'replace', meaning invalid sequences are replaced by a placeholder character.

What "placeholder character" is it that's used?

  1. unquote

encoding defaults to 'utf-8'. errors defaults to 'replace', meaning invalid sequences are replaced by a placeholder character.

Is a single line. errors should be on a new line (all arguements for all functions really should always be on a new line unless there's a compelling reason not to. To do otherwise significantly impedes readability, while increasing the chances of misunderstanding).

@mohmad-null mohmad-null added the docs Documentation in the Doc dir label May 12, 2025
@vadmium
Copy link
Member

vadmium commented May 14, 2025

1: The default for quote(errors=. . .) has annoyed me too. My interpretation is that passing errors=None and errors='strict' must be equivalent, it this could be worded better.

2 & 3: For the possible values, the documentation already refers to the str.encode and bytes.decode methods, which in turn both refer to https://docs.python.org/3/library/codecs.html#error-handlers. The possible values of errors depends on which error handlers have been registered at runtime.

4: The placeholder is the Unicode replacement character, also defined in the codecs documentation.

5: For the paragraph about the default encoding and errors values, they are related parameters and I don’t think splitting the paragraph would be beneficial. However, it would be easier to read if each sentence started with a capital letter.

@vadmium
Copy link
Member

vadmium commented May 14, 2025

Issue #130578 is already open about the confusion of the quote default values (Point 1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir
Projects
Status: Todo
Development

No branches or pull requests

2 participants