argparse modify
Chris Angelico
rosuav at gmail.com
Thu Jun 23 19:10:43 EDT 2022
On Fri, 24 Jun 2022 at 09:03, Mats Wichmann <mats at wichmann.us> wrote:
> Also note that while it's claimed to be fine These Days, inheriting from
> a base type like this is sometimes tricky, sometimes broken... be
> somewhat aware.
Depends on your definition of "broken". If you want to make a custom
integer type, you'll probably find that arithmetic operations on it
just return vanilla ints again, but in this case, it seems to be more
akin to IntEnum than to an arithmetic type. so it should be safe.
But that said: why not just use IntEnum? It looks like the purpose of
it is simply to be a name for a number, and that's something that an
enum does well (even if it's not strictly "enumerated" in that sense).
ChrisA
More information about the Python-list
mailing list