Skip to content

gh-101536: [docs] Improve attributes of urllib.error.HTTPError#101612

Merged
facundobatista merged 2 commits into
python:mainfrom
sobolevn:issue-101536
Feb 18, 2023
Merged

gh-101536: [docs] Improve attributes of urllib.error.HTTPError#101612
facundobatista merged 2 commits into
python:mainfrom
sobolevn:issue-101536

Conversation

@sobolevn
Copy link
Copy Markdown
Member

@sobolevn sobolevn commented Feb 6, 2023

There are several tricky parts:

  1. The are multiple aliases. url and filename, hdrs and headers, code and status, msg and readonly reason. Which ones should we document? My idea was that we should try to stick to the same names we use in constructor. But, with some exceptions. For example: filename does not make much sense here: I changed it to be url. And the same with msg and hdrs: I use reason and headers
  2. Do we need to list aliases? I think so, because otherwise it would be hard to understand that msg and reason are the same thing

CC @facundobatista @orsenthil

Comment thread Doc/library/urllib.error.rst Outdated
.. attribute:: url

Contains the request URL.
Is an alias for *filename* attribute.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe more concisely, the 'Is' can be dropped here and below? Not sure which style's better though.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not a native speaker, so I am fine with any decision, which sounds better :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not English native speaker either, but "Alias for ..." sounds better to me.

@ngie-eign
Copy link
Copy Markdown
Contributor

My 2 cents: it seems like the shorter property names should be discouraged: the variable names are more cryptic to read in code and might confuse developers/laypeople who don’t know what the shorthand means.

@sobolevn
Copy link
Copy Markdown
Member Author

sobolevn commented Feb 9, 2023

it seems like the shorter property names should be discouraged

Yes, this exactly what I was thinking. That's why I went with the longer and more semantic names in the docs.

Copy link
Copy Markdown
Member

@facundobatista facundobatista left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello! Thanks for this work. I added a minor detail here.

Regarding your questions, we need to document everything that is public. I like the approach you took of listing first the "good names", declaring the others as aliases.

Comment thread Doc/library/urllib.error.rst Outdated

.. attribute:: fp

A file-like object with the HTTP error body.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file like object does not have the body, you can read from it. I'd write something like "A file-like object where the HTTP error body can be read from."

@bedevere-bot
Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@sobolevn
Copy link
Copy Markdown
Member Author

I have made the requested changes; please review again

Thanks everyone!

@bedevere-bot
Copy link
Copy Markdown

Thanks for making the requested changes!

@facundobatista: please review the changes made to this pull request.

Copy link
Copy Markdown
Member

@facundobatista facundobatista left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonderful, thanks!

@ngie-eign
Copy link
Copy Markdown
Contributor

Thank you so very much everyone!!!

Copy link
Copy Markdown
Member

@orsenthil orsenthil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. :) LGTM.

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 skip news

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants