Wrong parameter name in http.client.read documentation: "amt" vs "n"

pydoc http.client.HTTPResponse.read
results in help text:

http.client.HTTPResponse.read = read(self, amt=None)
    Read and return up to n bytes.

The parameter is called “amt” but the help text refers to “n”.

Should be an easy enough fix, just change it to say up to amt bytes. Want to put in a pull request?

1 Like

It’s correct in the prose docs, and there’s no docstring where this function is defined. It seems its inherited from the docstring of the C implementation of the BufferedIOBase.read() function, from which the HTTPResponse class ultimately inherits.

However, that docstring is presumably generic for multiple functions (in fact, I’ve seen and edited similar variations elsewhere), I would think it shouldn’t be touched there, and instead the HTTPResponse.read() function given a more specifically-tailored docstring of its own including the fix, unless there’s a reason not to do so.

Thank you! Created an https://github.com/python/cpython/issues/103112 and PR