Skip to content

Misleading comment in enum.verify.__call__ #136764

@azerty-svg

Description

@azerty-svg

I saw some nonsense in a comment.

 if enum_type == 'flag':
                    # check for powers of two
                    for i in range(_high_bit(low)+1, _high_bit(high)):
                        if 2**i not in values:
                            missing.append(2**i)
                elif enum_type == 'enum':
                    # check for powers of one
                    for i in range(low+1, high):
                        if i not in values:
                            missing.append(i)

The nonsense in this code, present in the class EnumCheck, is the comment about powers of 1. What is meant is rather "checking the identifiers are contiguous".
I suggest replacing the comment with something more suitable.

Linked PRs

Metadata

Metadata

Assignees

Labels

docsDocumentation in the Doc direasystdlibPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or error

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions