Skip to content
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 net_handle_t bindings to include equality and hash #190

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

xchang1
Copy link
Contributor

@xchang1 xchang1 commented Sep 9, 2023

I wanted net_handle_t's to be used in sets in python so I needed the bindings to include equality and hashing.

@adamnovak or maybe @ctcisar, can I do this? It looks like the binding code is automatically generated so I'm worried it'll get overwritten, but this was the only way I could figure out to get it to do what I wanted

@xchang1 xchang1 requested a review from adamnovak September 9, 2023 14:07
@adamnovak
Copy link
Member

I don't think this will stick around. I think we would need a member operator== for BInder to bind it to Python's equality check: https://cppbinder.readthedocs.io/en/latest/limitations.html#external-operators

If we want to customize the bindings for a type, we can use an +add_on_binder directive in the Binder config file, break this code out into its own function that takes I think cl as an argument, and then get Binder to generate the code to call that function: https://cppbinder.readthedocs.io/en/latest/config.html?highlight=add_on_binder#config-file-directives

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants