"Vincent Davis" <[email protected]> wrote

class BString(XString):
   """ Biological string """

   _bstring_constructor = biostrings.BString

   @classmethod
   def new(cls, x):
       """ :param x: a (biological) string """
       res = cls(cls._bstring_constructor(conversion.py2ri(x)))
       _setExtractDelegators(res)
       return res

OK, I see what they are doing but as far as I can tell this could be put in a __new__ method just as easily which would retain the usual instantiation style.

Any gurus out there able to explain why they have used an explicit new() class method rather than __new__()?

--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/

_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to