Closed
Description
Required prerequisites
- Make sure you've read the documentation. Your issue may be addressed there.
- Search the issue tracker and Discussions to verify that this hasn't already been reported. +1 or comment there if it has.
- Consider asking first in the Gitter chat room or in a Discussion.
What version (or hash if on master) of pybind11 are you using?
master
Problem description
py::enum_
supported class docstrings (as did boost::python::enum_). It would be nice if the new py::native_enum
would support class docstrings.
Since the native enum type (a string) is optional, converting my code to use thew new native_enum forced me to review each instance, since by default my docstrings were interpreted as the native enum. Maybe the native enum could be an enum or a class type, so we could have a constructor like
template <typename... Extra>
native_enum(const object &parent_scope,
const char *name,
const Extra &...extra)
where the extra arguments could be a docstring and/or a native enum.
This would allow a "complete" replacement and less error-prone conversion to the new native_enum
. An alternative could be to add a method native_enum::set_doc(const char* doc)
.
Reproducible example code
Is this a regression? Put the last known working version here if it is.
Not a regression