<span></span><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
<span class="Apple-style-span" style="border-collapse: separate; font-family: arial; font-size: small; ">That&#39; a very strange idiom in Python.<br>Can you show us the class definition?</span></blockquote><div><br></div>
It&#39;s a bioconductor extension to rpy2<div><a href="http://www.bitbucket.org/lgautier/rpy2-bioc-extensions/overview/" target="_blank" style="color: rgb(28, 81, 168); ">http://www.bitbucket.org/lgautier/rpy2-bioc-extensions/overview/</a></div>
<div>I am trying to learn R and at they same time more about python and R bioconductor packages. So no it is not homework but I am trying to learn something. I am sure the answer is obvious when you know it :)</div><div>Here is the class, although it is obviously part of something bigger, you can checkout the full code at <a href="http://bitbuckit.org/" target="_blank" style="color: rgb(28, 81, 168); ">bitbuckit.org</a></div>
<div><br></div><div><div>class BString(XString):</div><div>    &quot;&quot;&quot; Biological string &quot;&quot;&quot;</div><div>    </div><div>    _bstring_constructor = biostrings.BString</div><div><br></div><div>    @classmethod</div>
<div>    def new(cls, x):</div><div>        &quot;&quot;&quot; :param x: a (biological) string &quot;&quot;&quot;</div><div>        res = cls(cls._bstring_constructor(conversion.py2ri(x)))</div><div>        _setExtractDelegators(res)</div>
<div>        return res</div></div></span><div name="mailplane_signature"> <table><tbody><tr><td width="80">
<img src="http://www.gravatar.com/avatar/226e40fdc55d4597a46279296a616384.png">
</td><td width="10"></td><td width="127" align="center">
<div style="padding-right: 5px; padding-left: 5px;
font-size: 11px; padding-bottom: 5px; color: #666666;
padding-top: 5px">
  <p><strong>Vincent Davis<br>
    720-301-3003
  </strong><br>
    
    <a href="mailto:vincent@vincentdavis.net">vincent@vincentdavis.net</a>  </p>
<div style="font-size: 10px">
  <a href="http://vincentdavis.net">my blog</a> |
  <a href="http://www.linkedin.com/in/vincentdavis">LinkedIn</a></div></div></td></tr><tr></tr></tbody></table></div><br><br><div class="gmail_quote">On Mon, Apr 5, 2010 at 1:08 PM, Alan Gauld <span dir="ltr">&lt;<a href="mailto:alan.gauld@btinternet.com">alan.gauld@btinternet.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">&quot;Vincent Davis&quot; &lt;<a href="mailto:vincent@vincentdavis.net" target="_blank">vincent@vincentdavis.net</a>&gt; wrote <br>

</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I am working an a open source project and would like to add feature to a<div class="im"><br>
class.<br>
Current action:<br>
in:    &gt;&gt;&gt;b = BString.new(&#39;I am a BString object&#39;)<br>
</div></blockquote>
<br>
That&#39; a very strange idiom in Python.<br>
Can you show us the class definition?<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
out:  &gt;&gt;&gt;b<br>
in:    &gt;&gt;&gt;&lt;BString - Python:0x1044846c8 / R:0x105c86f50&gt;<br>
in:    &gt;&gt;&gt;print(b)<br>
out:  &gt;&gt;&gt; 21-letter &quot;BString&quot; instance<br>
              seq: I am a BString object<br>
<br>
What I would like is to be able to<br>
in   &gt;&gt;&gt;b<br>
out &gt;&gt;&gt;21-letter &quot;BString&quot; instance<br>
              seq: I am a BString object<br>
<br>
I have 2 questions<br>
1, how do I do this?<br>
2, how does print know what to do?<br>
</blockquote>
<br></div>
If you look at your class definition that should become obvious.<br>
Are you sure this isn&#39;t a homework?<br>
<br>
<br>
-- <br>
Alan Gauld<br>
Author of the Learn to Program web site<br>
<a href="http://www.alan-g.me.uk/" target="_blank">http://www.alan-g.me.uk/</a><br>
<br>
_______________________________________________<br>
Tutor maillist  -  <a href="mailto:Tutor@python.org" target="_blank">Tutor@python.org</a><br>
To unsubscribe or change subscription options:<br>
<a href="http://mail.python.org/mailman/listinfo/tutor" target="_blank">http://mail.python.org/mailman/listinfo/tutor</a><br>
</blockquote></div><br>