Skip to content
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

Small linkrot items worth fixing #52

Open
amontalenti opened this issue Oct 21, 2024 · 0 comments
Open

Small linkrot items worth fixing #52

amontalenti opened this issue Oct 21, 2024 · 0 comments
Assignees
Labels

Comments

@amontalenti
Copy link
Owner

In this line:

See the requests.api module, for example

The api.py link no longer works.

In this line:

Note that Python includes a rich set of built-in exception classes. Leverage these appropriately, and you should "customize" them simply by instantiating them with string messages that describe the specific error condition you hit. It is most common to raise ValueError (bad argument), LookupError (bad key), or AssertionError (via the assert statement) in user code.

The link to the exception hierarchy uses Python 2 docs.

In this line:

As described in the blog post, "Python double-under, double-wonder", there is nothing "special" about dunders. They are nothing more than a lightweight namespace the Python core developers picked for all of Python's internal protocols. After all, init is a dunder, and there's nothing magic about it.

The redirect domain for the link can be updated.

In this line:

Also, don't re-invent the wheel. One thing str.format does unequivocally better is support various formatting modes, such as humanized numbers and percentages. Use them.

The link is for Python 2 docs.

Same for this line:

Truthiness is a tad complicated in Python and certainly the latter is safer against some classes of bugs. The former, however, is very common in much Python code, and it's shorter. We choose not to care.

And this one:

Essentially, Python turns the first line into the second automatically. You should probably prefer the second form, if for no other reason than to actually provide a useful argument, like a helpful message about why the ValueError occurred.

@amontalenti amontalenti self-assigned this Oct 21, 2024
Repository owner deleted a comment Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant