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

Enhancement request: Interned objects for python identity #109

Open
rpgoldman opened this issue Oct 28, 2019 · 0 comments
Open

Enhancement request: Interned objects for python identity #109

rpgoldman opened this issue Oct 28, 2019 · 0 comments

Comments

@rpgoldman
Copy link

It seems that a pySBOL Document object can have non-identical objects that correspond to the same URI. I.e., foo != bar but foo.identity == bar.identity. This seems bound to lead to bugs in future code written in pySBOL.

I believe that a solution could be crafted by having a persistent interface the source of the SBOL document, and ensuring that pySBOL objects are treated as interned objects. I.e., if pySBOL receives a request for an SBOL identity that has already been pulled down, pySBOL should return the previous object, instead of creating a new one.

If this is for some reason infeasible, the second best solution would be to disable equality checking for pySBOL objects. Doing so would force the user to equality check the URIs instead of the objects. Apparently this can be achieved by overriding __eq__ and __ne__ (see https://stackoverflow.com/questions/390250/elegant-ways-to-support-equivalence-equality-in-python-classes). This wouldn't be ideal, because sometimes one might want to check for object equality instead of URI identity, hence my preference for interning, which would make object equality and SBOL identity congruent.

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

No branches or pull requests

1 participant