[Biopython-dev] Dynamic class return in Seq class

Charles Vejnar charles.vejnar at isb-sib.ch
Wed Mar 28 16:14:33 UTC 2007


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,

More information about the Biopython-dev mailing list