3 ms·
> Before P2996, generating Python bindings required either: I'm missing nanobind here. > Method lookup. Python sees a.dot and searches for the dot attribute.
by kvemkon 10mo ago
> Before P2996, generating Python bindings required either:
I'm missing nanobind here.
> Method lookup. Python sees a.dot and searches for the dot attribute. It checks a.__dict__,
> Each attribute access (self.x) involves:
Dictionary lookup in self.__dict__
Since C++ classes are fixed, I'd expect attributes to be declared once in python (slots).
One thing yet important for cross-language projects: callbacks (events). Would be nice if the sample could be extended.
- fthiesen 10mo agoThanks for the suggestion, let me take a good look at callbacks. Another thing that I can't make work elegantly is compiling template functions from C++, since we have no clue to guess which types will be instantiated in the Python code (and they can even depend on user input, so only determined at runtime)