Skip to content

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

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

Merged
merged 2 commits into from
Feb 18, 2023

Conversation

sobolevn
Copy link
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

.. attribute:: url

Contains the request URL.
Is an alias for *filename* attribute.
Copy link
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
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
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
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
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
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.


.. versionadded:: 3.4

.. attribute:: fp

A file-like object with the HTTP error body.
Copy link
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

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
Member Author

I have made the requested changes; please review again

Thanks everyone!

@bedevere-bot
Copy link

Thanks for making the requested changes!

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

Copy link
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
Contributor

Thank you so very much everyone!!!

Copy link
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