I believe that is the core question. In my use case it caused a bug because I
accidentally typed "Enum" instead of "MyEnum" and the "len" worked, which is
something I did not expect. However I do not know how prevalent this mistake is.
___
Python-ideas
> Yes, that is correct. Any subclass of Enum will also be a type, and
will have a length.
That is the correct and expected behavior, as described on
https://docs.python.org/3/library/enum.html
> Yeah, and I'm of the opinion that it's not a problem for Enum to have
zero possible values, but to ha
Hi Richard,
On Tue, 4 Apr 2023 at 12:49, Richard Hajek wrote:
>
> I encountered that Enum having a len hid a mistake on my part. If len(Enum)
> raised, my mistake would be immediately apparent, however at the end of the
> day, my mistake was easily found.
Can any Python linting tools (such as
I have what I think is a fairly low impact quality of life improvement to
suggest for the python CLI.
When I'm not working in Python I tend to be working in bash. But often I
want to break out and do something quick in Python. I find the `python -c `
CLI very useful for this. For one liners it's p
Hi
Here's a similar example
$ python3
> Python 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> from collections import Counter
> >>> cnt = Counter # Oops!
> >>> cnt.update('abcde')
> >>> cnt
>
>
This is wh
On 4/1/23 07:45, Richard Hajek wrote:
> # Feature or enhancement
>
> `len(Enum)` has no useful meaning and should therefore raise the appropriate
error
>
> # Pitch
>
> I cannot figure out any scenario, in which len(Enum) should not raise. Enum is a type and as any other types, such as
`len(list)