<div dir="ltr"><div>True doing the subclassing would immediately define the missing methods by default, but then risk a behavior change later as we make them sequence aware. Please try this on a branch or pull request?<br></div><div><br></div><div>Peter</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 28, 2017 at 11:20 AM, Michiel de Hoon <span dir="ltr"><<a href="mailto:mjldehoon@yahoo.com" target="_blank">mjldehoon@yahoo.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="color:#000;background-color:#fff;font-family:Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:10px"><div id="m_9038631847494789106yui_3_16_0_1_1498644225839_25815">We could move faster by doing the subclassing first. There is a price for being too rigorous: Improvements are taking too long to happen. Ten years in this case.<br></div><div id="m_9038631847494789106yui_3_16_0_1_1498644225839_25816"><br></div><div id="m_9038631847494789106yui_3_16_0_1_1498644225839_25898">Best,</div><div id="m_9038631847494789106yui_3_16_0_1_1498644225839_25899">-Michiel<br></div><div><div class="h5"><div id="m_9038631847494789106yui_3_16_0_1_1498644225839_25687"><span></span></div> <div class="m_9038631847494789106qtdSeparateBR"><br><br></div><div class="m_9038631847494789106yahoo_quoted" style="display:block"> <div style="font-family:Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:10px"> <div style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:16px"> <div dir="ltr"><font size="2" face="Arial"> On Monday, June 26, 2017 6:21 PM, Peter Cock <<a href="mailto:p.j.a.cock@googlemail.com" target="_blank">p.j.a.cock@googlemail.com</a>> wrote:<br></font></div>  <br><br> <div class="m_9038631847494789106y_msg_container"><div dir="ltr">Hello all,<br clear="none"><br clear="none">Looking at the mailing list archive, the plain text version didn't capture<br clear="none">Michael's link to the thread ten years ago:<br clear="none"><br clear="none"><a shape="rect" href="http://lists.open-bio.org/pipermail/biopython/2007-August/009867.html" target="_blank">http://lists.open-bio.org/<wbr>pipermail/biopython/2007-<wbr>August/009867.html</a><br clear="none"><br clear="none">We're still at step two of that outlined plan:<br clear="none"><br clear="none">Peter wrote in August 2007:<br clear="none">> (1) Modify Seq .__str__() method to ... return self.data<br clear="none">><br clear="none"><br clear="none">Done, along with changes to __eq__ to match etc.<br clear="none"><br clear="none">> (2) Consider adding alphabet aware versions selected string methods to<br clear="none">> the Seq object (e.g. count, find)<br clear="none"><br clear="none">While we have count, find, upper, lower, etc we still don't have all the<br clear="none">string methods defined for the Seq object (e.g. replace is missing -<br clear="none">what else?)<br clear="none"><br clear="none">> Then, for the release afterwards:<br clear="none">> (3) actually do the class inheritance with all the horrors entailed.<br clear="none"><br clear="none">And this is of course pending - as per this thread title.<br clear="none"><br clear="none">--<br clear="none"><br clear="none">Note that in addition to supporting all the base string methods, we<br clear="none">still want the Seq object to also support extra biological methods<br clear="none">and perhaps additional optional arguments, e.g. overlapping counts:<br clear="none"><br clear="none"><a shape="rect" href="https://github.com/biopython/biopython/issues/1294" target="_blank">https://github.com/biopython/<wbr>biopython/issues/1294</a><br clear="none"><br clear="none">Other than the translate method (mentioned below), I don't think we<br clear="none">have any name or argument clashes to worry about.<br clear="none"><br clear="none">Regards,<br clear="none"><br clear="none">Peter<br clear="none"><br clear="none"><br clear="none">On Wed, May 24, 2017 at 10:28 AM, Peter Cock <<a shape="rect" href="mailto:p.j.a.cock@googlemail.com" target="_blank">p.j.a.cock@googlemail.com</a>> wrote:<br clear="none">><br clear="none">> Hi Michiel,<br clear="none">><br clear="none">> I think we'd need to work on making the API more string like before it would be practical to considering subclassing.<br clear="none">><br clear="none">> Would anyone like to make a list of all the string methods which we do not currently implement, starting with replace (where dealing with the alphabet is tricky if new letters are introduced)?<br clear="none">><br clear="none">> Then there is the translate method where we deliberately did not follow the Python string method behaviour, but it would be possible to match it as a special case where currently we issue an exception:<br clear="none">><br clear="none">> <a shape="rect" href="https://github.com/biopython/biopython/blob/biopython-169/Bio/Seq.py#L985" target="_blank">https://github.com/biopython/<wbr>biopython/blob/biopython-169/<wbr>Bio/Seq.py#L985</a><br clear="none">><br clear="none">> Peter<br clear="none">><br clear="none">><br clear="none">><br clear="none">><br clear="none">> On Tue, May 23, 2017 at 2:32 AM, Michiel de Hoon <<a shape="rect" href="mailto:mjldehoon@yahoo.com" target="_blank">mjldehoon@yahoo.com</a>> wrote:<br clear="none">>><br clear="none">>> Dear all,<br clear="none">>><br clear="none">>> Ten years ago we talked about subclassing Seq objects from a string:<br clear="none">>><br clear="none">>> [BioPython] Making the Seq object act more like a string<br clear="none">>> <a shape="rect" href="http://lists.open-bio.org/pipermail/biopython/2007-August/009867.html" target="_blank">http://lists.open-bio.org/<wbr>pipermail/biopython/2007-<wbr>August/009867.html</a><div class="m_9038631847494789106yqt6638886566" id="m_9038631847494789106yqtfd28806"><br clear="none">>><br clear="none">>> Can we move forward?<br clear="none">>> As the Seq documentation says, a Seq object is essentially a string with an alphabet.<br clear="none">>> Then, following the object oriented programming paradigm, Seq objects should inherit from a string object.<br clear="none">>><br clear="none">>> This would help with C extensions that take Seq or string objects as arguments (as both can then be treated as strings).<br clear="none">>><br clear="none">>> Best,<br clear="none">>> -Michiel<br clear="none">>><br clear="none">>> ______________________________<wbr>_________________<br clear="none">>> Biopython-dev mailing list<br clear="none">>> <a shape="rect" href="mailto:Biopython-dev@mailman.open-bio.org" target="_blank">Biopython-dev@mailman.open-<wbr>bio.org</a><br clear="none">>> <a shape="rect" href="http://mailman.open-bio.org/mailman/listinfo/biopython-dev" target="_blank">http://mailman.open-bio.org/<wbr>mailman/listinfo/biopython-dev</a><br clear="none">><br clear="none">><br clear="none"></div></div><br><br></div>  </div> </div>  </div></div></div></div></div></blockquote></div><br></div>