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

Avoid storing __eq__ operator for every taxon_info object #60

Open
emilydolson opened this issue Dec 5, 2023 · 0 comments
Open

Avoid storing __eq__ operator for every taxon_info object #60

emilydolson opened this issue Dec 5, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@emilydolson
Copy link
Owner

Currently, to support NumPy's unconventional == operator (returns array of bools, not a bool), the constructor for taxon_info reaches into Python, grabs the object's classes __eq__ operator, and then uses a try-catch statement to swap in the numpy.array_equal operator.

For a given systematics manager, however, the == should be the same for all taxon_info objects. Thus, there is almost certainly a way to store single copy per systematics manager and avoid having to reach into Python every time the constructor is called.

Possible solutions:

  1. The equals operator could live in the wrapped systematics object (need to figure out how to give taxon_info objects access to it).
  2. The taxon_info object could have the equals operator as a static member (tricky, because it can seg-fault on destruction)
@emilydolson emilydolson added the enhancement New feature or request label Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant