Skip to content

Choices derived enum-properties types do not unpack member tuples on declaration #136

@bckohan

Description

@bckohan

For example, should be able to do this:

        class AliasesFlag(FlagChoices):
            A = 1 << 0, "a"
            B = 1 << 1, "b"
            C = 1 << 2, "c"
            AB = A | B, "ab"
            BC = B | C, "bc"
            ABC = A | B | C, "abc"

But have to do this:

        class AliasesFlag(FlagChoices):
            A = 1 << 0, "a"
            B = 1 << 1, "b"
            C = 1 << 2, "c"
            AB = A[0] | B[0], "ab"
            BC = B[0] | C[0], "bc"
            ABC = A[0] | B[0] | C[0], "abc"

This is a result of an awkward interaction between the ChoicesType and the enum-properties metaclass. When just a label is present the logic that unpacks member tuples is not run by the class dictionary.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions