Replies: 1 comment
-
I don't plan to work on this feature myself, but I am open to external contributions if they don't add too much extra complexity. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Now that Nanobind has support for
enum(IntEnum)
, supportingenum(IntFlag)
seems like a nice addition.Here's a motivating case for it:
The latter case unfortunately doesn't type check:
This can be fixed by typing functions differently, f.ex. by typing input flag arguments as
int
instead ofInputTextFlags
.But Python enums support a more type safe alternative, the
enum.IntFlag.
Perhaps there could be an enum annotation, say
nb::is_intflag()
, similar to the existingnb::is_arithmetic()
flag to signal Nanobind to useIntFlag
instead ofIntEnum
?Beta Was this translation helpful? Give feedback.
All reactions