Skip to content

Update net_handle_t bindings to include equality and hash#190

Closed
xchang1 wants to merge 5 commits intomasterfrom
python_nethandles
Closed

Update net_handle_t bindings to include equality and hash#190
xchang1 wants to merge 5 commits intomasterfrom
python_nethandles

Conversation

@xchang1
Copy link
Copy Markdown
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
Copy Markdown
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

Copy link
Copy Markdown
Member

@adamnovak adamnovak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only change is updating libhandlegraph and building the bindings.

But we probably need a PR on the libhandlegraph side.

@xchang1
Copy link
Copy Markdown
Contributor Author

xchang1 commented Oct 26, 2025

I waited too long to merge this and there are too many conflicts so I'm going to redo it

@xchang1 xchang1 closed this Oct 26, 2025
@xchang1 xchang1 deleted the python_nethandles branch October 26, 2025 18:34
@xchang1 xchang1 mentioned this pull request Oct 26, 2025
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