[Biopython-dev] Bio.Motif length

Bartek Wilczynski barwil at gmail.com
Wed Oct 27 10:53:58 UTC 2010


Hi Peter,

On Wed, Oct 27, 2010 at 12:34 PM, Peter <biopython at maubp.freeserve.co.uk>wrote:

>
> Why do you have motif.length when len(motif) seems to do
> basically the same thing? Can we deprecate the length
> property (Zen of Python: There should be one -- and
> preferably only one -- obvious way to do it)?
>
>
I guess this is there just out of habit. I know that the .length property
and I tend to use it, but I agree that in the tutorial we should use len(m)
instead of m.length.

Speaking more globally, the length property is there from the beginning, I
don't think we should remove it. If we really want to make the API clean, we
could rename it to m._length to indicate that it should not be used directly
(especially setting it to some other value could have unwanted
consequences).

I can make the change in the tutorial (I need to change the expected output
of m.format("fasta") anyway), but making the change from .length to ._length
in the code would require a bit more time to make sure I'm not using it
anywhere in the code. What is your suggestion here?

cheers
B



More information about the Biopython-dev mailing list