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

Incorrect hexadecimal to decimal conversion in enum example #118443

Closed
array93 opened this issue Apr 30, 2024 · 3 comments
Closed

Incorrect hexadecimal to decimal conversion in enum example #118443

array93 opened this issue Apr 30, 2024 · 3 comments
Labels
docs Documentation in the Doc dir

Comments

@array93
Copy link

array93 commented Apr 30, 2024

Documentation

Section describing __new__(cls, *args, **kwds) says:

results in the call int('1a', 16) and a value of 17 for the member.

While class int(x, base=10) suggests the value would be 26 since 1A hex is 26 decimal.

Also wouldn't the enum in the example need to inherit from int to get its __new__ implementation? I'm confused about the mixed-in.

@array93 array93 added the docs Documentation in the Doc dir label Apr 30, 2024
@array93
Copy link
Author

array93 commented Apr 30, 2024

also the example itself does not implement __new__ which would make the value a tuple?

@eendebakpt
Copy link
Contributor

@array93 Thanks for reporting, you are right the documentation was not correct. The issue was recently fixed in #118311. That change will take some time though before it ends up in the official documentation.

@hugovk
Copy link
Member

hugovk commented May 1, 2024

Thanks both, let's mark this as a duplicate of #118310.

@hugovk hugovk closed this as not planned Won't fix, can't repro, duplicate, stale May 1, 2024
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
Projects
None yet
Development

No branches or pull requests

3 participants