[Python-ideas] Re: len(Enum) should raise TypeError

2023-04-03 Thread Benedict Verhegghe
Well, it's not an object of type 'type' like the list or dict mentioned by the OP, for which len() give a TypeError: object of type 'type' has no len() Any derived class of Enum will also return True for isinstance(..., type). Should the derived classes then neither have a meaningful result for

[Python-ideas] Re: len(Enum) should raise TypeError

2023-04-03 Thread Chris Angelico
On Mon, 3 Apr 2023 at 17:57, Benedict Verhegghe wrote: > > Well, it's not an object of type 'type' like the list or dict mentioned > by the OP, for which len() give a > TypeError: object of type 'type' has no len() I'm not sure what you mean here. Enum is of type EnumMeta, which is a subclass of