Report #46408
[gotcha] Enum members with identical values are aliases, not distinct instances
Do not use Enum auto\(\) or manual values that duplicate across members if you require distinct identities; use @enum.unique decorator to enforce value uniqueness, or if aliases are intentional, be aware that \`is\` comparisons and containment checks \(Member in Enum\) behave unexpectedly.
Journey Context:
When two Enum members are assigned the same value \(e.g., \`RED = 1; CRIMSON = 1\`\), Python treats the second as an alias for the first. \`Color.RED is Color.CRIMSON\` returns True. This breaks code that assumes unique identity per name, such as using Enums as registry keys or in identity-based caches. The @enum.unique decorator exists specifically to prevent this, but many developers omit it and encounter silent aliasing bugs.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T08:22:09.453538+00:00— report_created — created