-
Notifications
You must be signed in to change notification settings - Fork 769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Wrapper #1712
Update Wrapper #1712
Conversation
cdcf23207 Merge pull request #163 from borglab/dunder-methods 22d429cc2 use STL functions instead of container methods abe8818ab update pyparsing to 3.1.1 a9e896d0c add unit tests 535fe4f14 wrap supported dunder methods 079687eac parse dunder methods in interface file git-subtree-dir: wrap git-subtree-split: cdcf23207fbb03457c5d9dbfc2b0b57e515b5f3d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Though I do think in gtwrap the __contains__
should use .find()
instead of std::find
but 👍
gtsam/gtsam.i
Outdated
@@ -39,6 +39,11 @@ class KeyList { | |||
void remove(size_t key); | |||
|
|||
void serialize() const; | |||
|
|||
// Specual dunder methods for Python wrapping |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: "Specual" -> "Special"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected! I agree with the comment about .find()
but until we move to C++20, many C++ STL containers won't support a find
method. :(
Update the wrapper with new functionality supporting a new double-underscore (dunder) syntax. This makes wrapping classes that should exhibit some behavior in Python easier.
E.g. there is an ask in #1606 for
KeySet
to allow iteration and other container based operations. By adding__iter__
and__contains__
dunder methods to thegtsam.i
file, we now support those operations.This means we can now do this:
Consequently, fixes #1606.