You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
It seems that a pySBOL
Document
object can have non-identical objects that correspond to the same URI. I.e.,foo != bar
butfoo.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.The text was updated successfully, but these errors were encountered: