Replies: 1 comment 7 replies
-
It's surprising that this works with pybind11, and it seems more like an oversight to me rather than something that should be ported. I am not convinced by the performance argument -- the "slow" version should boil down to one more hash table lookup (in a hash table that is extremely fast -- we are talking about 1-2 loads). This seems vanishingly small to me in the bigger scheme of things. Happy to be proven wrong, but I would first like to see a benchmark demonstrating "much faster runtime". In the case of pybind11, I can see how the cost would be high (casting from one type to another is one of its bottlenecks). |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a heavily templated parent class that I do not want to bind directly. I only want to bind the non-templated child classes. However, this does not work at runtime. Here is a minimal example:
At runtime
this gives
(With pybind11 this strategy does work, and some informal test suggests that it is much faster at runtime than using
py::class_<Foo, Bar>(m, "Foo")
and bindingBar
. This seems to hold true for nanobind.)Beta Was this translation helpful? Give feedback.
All reactions