Replies: 2 comments
-
I think this is more of a question than a bug report, so I converted it to a discussion. I don't have any good ideas, but perhaps others can comment. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Apparently nanobind registers it's own type, and we can query if we have some attribute registered or not. If attribute is registered - then we can use Otherwise we can just set the value into dynamic properties container.
|
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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
It would be nice to be able to support dynamic amount of properties in class. Theoretically it can be achieved using code snippet like this:
Class will have
MyProperty
and any amount of properties fromdynamic_properties
.And this code would work fine:
However - assignment will work for dynamic properties, but not for property defined by nanobind.
Issue seems to be that this assignment will call
__setattr__
without further call to[](Wrapper& wrapper, bool value) { ... }
.What I was thinking - is that maybe instead of using
__getattr__
and__setattr__
, I would register dynamic properties in similar manner todef_prop_rw
method call.Both approach seems to be bit difficult, maybe you can recommend better approach ?
Beta Was this translation helpful? Give feedback.
All reactions