[Biopython-dev] SeqRecord comparison suggestion

Peter Cock p.j.a.cock at googlemail.com
Tue Feb 4 20:56:12 UTC 2014


On Tuesday, February 4, 2014, Lenna Peterson <arklenna at gmail.com> wrote:

> On Tue, Feb 4, 2014 at 12:57 PM, Iddo Friedberg <idoerg at gmail.com<javascript:;>>
> 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
>

We should probably switch the current FutureWarning to a noisy
BiopythonWarning ... because the current warning is (almost) silent. I
think this was silenced in a recentish Python release, from memory it used
to give a clear warning to the user :(

Peter



More information about the Biopython-dev mailing list