[Tutor] Use __str__ method for int values
eryksun
eryksun at gmail.com
Sun Mar 10 11:29:34 CET 2013
On Sun, Mar 10, 2013 at 4:57 AM, Vincent Balmori
<vincentbalmori at yahoo.com> wrote:
> I am trying to use a __str__ method to display the values of attribute mood
> = self.hunger + self. boredom.
__str__ has to return a string:
http://docs.python.org/3/reference/datamodel.html#object.__str__
Bookmark the "_" index of the docs as a quick reference for special methods:
http://docs.python.org/3/genindex-_.html
For the basic descriptions, follow the "(object method)" links.
More information about the Tutor
mailing list