Skip to content

Incorrect hexadecimal to decimal conversion in enum example #118443

@array93

Description

@array93

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions