[BioPython] Why _num_letters_in_database XMLBLAST parser?

Peter biopython at maubp.freeserve.co.uk
Mon Mar 31 15:02:05 UTC 2008


On Mon, Mar 31, 2008 at 3:39 PM, Sebastian Bassi <sbassi at gmail.com> wrote:
> On Mon, Mar 31, 2008 at 11:13 AM, Peter <biopython at maubp.freeserve.co.uk> wrote:
>  >  As Michiel didn't object, I've fixed this in CVS.  Thanks for the
>  >  alert Sebastian.
>
>  Could you please ADD the old code? I mean, keep both
>  num_letters_in_database and _num_letters_in_database. My code has to
>  run in current version (1.44 and 1.45 with _) but don't want it to
>  break in the next version. I think that leaving the old code (with _)
>  won't affect anybody, and you can mark it with a comment that this
>  code is kept for backward compatibility.

I'd rather not.  Firstly, old code shouldn't be using "private"
attributes anyway.  Secondly, as far as I know, you are the only
person this would affect, so it would be easier to fix it in your
code.  Something like:

try :
   count = record.num_letters_in_database
except AttributeError :
   #Hack for Biopython 1.45 or earlier
   count = record._num_letters_in_database

Of course, if there are lots of people out there also using
_num_letters_in_database then I guess we could support both for the
next release.

Peter



More information about the Biopython mailing list