[Biopython-dev] Dynamic class return in Seq class

Michiel Jan Laurens de Hoon mdehoon at c2b2.columbia.edu
Thu Mar 29 23:03:22 UTC 2007


In principle, I think that using self.__class__ instead of Seq is a good 
idea. But some Biopython tests fail with this substitution. It looks 
like these failures are trivial, but we do need to find some solution 
for them.

--Michiel.

Charles Vejnar wrote:
> Hi,
> 
> I would like to build a class which would inherit from Seq class. But in some 
> methods of the Seq class, return is like this :
> return Seq(s, self.alphabet)
> which makes my sub-class unusable (I always get a Seq instance instead of my 
> sub-class Seq instance).
> 
> I would like to avoid a delegation schema. So, is it possible to change the 
> returns from Seq(...) to  self.__class__(...) (as it's already done in the 
> __getslice__ method) or are there any reasons I am missing which justify 
> these returns ?
> 
> 
> Best regards,
> Charles
> _______________________________________________
> Biopython-dev mailing list
> Biopython-dev at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/biopython-dev


-- 
Michiel de Hoon
Center for Computational Biology and Bioinformatics
Columbia University
1130 St Nicholas Avenue
New York, NY 10032



More information about the Biopython-dev mailing list