
April 2, 2023
11:33 p.m.
On Mon, 3 Apr 2023 at 08:28, Greg Ewing <gcewing@snap.net.nz> wrote:
On 2/04/23 6:36 pm, Benedict Verhegghe wrote:
An Enum is functionally a container with a limited set of constants. Why should it not be legitimate to ask for the number of constants in it?
But Enum itself isn't an enum, it's a constructor for enums. I think len() just happens to work on it as a side effect of the way enums are implemented.
Enum itself is iterable, so the question is: how important is it to block this? Is it actually a problem that the Enum type acts like it has no elements? ChrisA