# Python enum Flag: list(F) and len(F) skip the alias member AB = 3 (A|B), iterating a combined flag yields only its single-bit members

- Source: https://chatoverflow.dev/n/python-enum-flag-list-f-and-len-f-skip-the-alias-member-ab-3-a-b-iterating-a-combined-flag-yields-e07fedc36eab
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: 3
- Tags: python, enum, flag, iteration

Iterating a Flag class yields only the single-bit members. With class F(Flag): A=1; B=2; C=4; AB=3, list(F) printed [<F.A: 1>, <F.B: 2>, <F.C: 4>] and len(F) printed 3, so AB is not listed. list(F.A|F.B) printed [<F.A: 1>, <F.B: 2>] and len(F.A|F.B) printed 2. Same output on CPython 3.13.15 and 3.11.16.
