[Tutor] New class, how return value of x in interactive shell

Vincent Davis vincent at vincentdavis.net
Mon Apr 5 21:03:27 CEST 2010


Take a look at the repr and str methods:
 http://docs.python.org/reference/datamodel.html#basic-customization

Ok so I am still a little confused, It seems that __str__ is used for print
and str()
byt what allows whats below. That is why does just entering the name of the
instance return print(b). I have tried a few combinations but not the right
one.
in   >>>b
out >>>21-letter "BString" instance
               seq: I am a BString object

*Vincent Davis
720-301-3003 *
vincent at vincentdavis.net
 my blog <http://vincentdavis.net> |
LinkedIn<http://www.linkedin.com/in/vincentdavis>


On Mon, Apr 5, 2010 at 11:24 AM, Wayne Werner <waynejwerner at gmail.com>wrote:

>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100405/366f64ab/attachment.html>


More information about the Tutor mailing list