Skip to content

Conversation

@Viicos
Copy link
Contributor

@Viicos Viicos commented Feb 3, 2026

This is a trivial improvement that I think doesn't require an issue.


📚 Documentation preview 📚: https://cpython-previews--144425.org.readthedocs.build/

@@ -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.
Copy link
Contributor Author

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 a TypeError, but I feel like this is generally known that invalid arguments raise TypeErrors?

Copy link
Member

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 is ipaddress which raises TypeErrors a bit everywhere...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hum then not documenting ValueError would maybe make sense? I had the correct assumption for TypeError, and wasn't sure for value errors but indeed it makes sense and once you know about this you can just write your try..except blocks from muscle memory

Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants