<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' a very strange idiom in Python.<br>Can you show us the class definition?</span></blockquote><div><br></div>
It'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> """ Biological string """</div><div> </div><div> _bstring_constructor = biostrings.BString</div><div><br></div><div> @classmethod</div>
<div> def new(cls, x):</div><div> """ :param x: a (biological) string """</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"><<a href="mailto:alan.gauld@btinternet.com">alan.gauld@btinternet.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">"Vincent Davis" <<a href="mailto:vincent@vincentdavis.net" target="_blank">vincent@vincentdavis.net</a>> 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: >>>b = BString.new('I am a BString object')<br>
</div></blockquote>
<br>
That' 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: >>>b<br>
in: >>><BString - Python:0x1044846c8 / R:0x105c86f50><br>
in: >>>print(b)<br>
out: >>> 21-letter "BString" instance<br>
seq: I am a BString object<br>
<br>
What I would like is to be able to<br>
in >>>b<br>
out >>>21-letter "BString" 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'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>