Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork34k
DocumentValueError being raised byUUID constructor#144425
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Conversation
| @@ -66,6 +66,7 @@ which relays any information about the UUID's safety, using this enumeration: | |||
| UUID(int=0x12345678123456781234567812345678) | |||
| Exactly one of *hex*, *bytes*, *bytes_le*, *fields*, or *int* must be given. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
We could also explicitly specify that this raises aTypeError, but I feel like this is generally known that invalid arguments raiseTypeErrors?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Usually:
- Invalid signature/usage/object types -> TypeError
- Valid type but invalid data -> ValueError
The only exception I'm aware of isipaddress which raises TypeErrors a bit everywhere...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Hum then not documentingValueError would maybe make sense? I had the correct assumption forTypeError, and wasn't sure for value errors but indeed it makes sense and once you know about this you can just write yourtry..except blocks from muscle memory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I am actually fine with documenting this. Sometimes we do document this, sometimes not.
Uh oh!
There was an error while loading.Please reload this page.
This is a trivial improvement that I think doesn't require an issue.
📚 Documentation preview 📚:https://cpython-previews--144425.org.readthedocs.build/