[Biopython-dev] SeqRecord comparison suggestion

Lenna Peterson arklenna at gmail.com
Tue Feb 4 18:54:34 UTC 2014


On Tue, Feb 4, 2014 at 12:57 PM, Iddo Friedberg <idoerg at gmail.com> wrote:

> Thanks!
>
> My initial thoughts are that seqrecord instances should not have an __eq__
> operator. The equality operation here is somewhat meaningless when you
> consider the number of parameters that can constitute a seqrecord,
> especially when dealing with a genomic record or  a contig. This can lead
> to unexpected behavior.


> That being said, it may be a good idea to allow for a function that
> performs a comprehensive comparison using all attributes.
>

I agree that an explicit comparison method would be less error-prone than
==. This method could even allow the user to specify which attributes must
be identical for equality.


> Specifically to answer your question: I don't think the address comparison
> is by design. It's a Python feature.
>

__eq__ and __ne__ could instead be defined to raise NotImplementedError to
prevent future users from experiencing the same problems and direct them to
the explicit comparison method.

Cheers,

Lenna



More information about the Biopython-dev mailing list