Re: [Tutor] Use __str__ method for int values

2013-03-10 Thread Jason Friedman
> Thank you for the response! I next modified the __str__ so it will also > include the values self. boredom and self. hunger. I am getting a bit > confused with how to set up strings from within a method. It is set up like > this: > > def __str__(self): > attrs = "Hunger: ", self.hunge

Re: [Tutor] Use __str__ method for int values

2013-03-10 Thread Jason Friedman
> I am trying to use a __str__ method to display the values of attribute mood > = self.hunger + self. boredom. > When I try to execute I get this error: > > Traceback (most recent call last): > File "C:/Users/Vincent/Documents/Programming Tutorials/Python Programming > for the Absolute Beginner -

Re: [Tutor] Use __str__ method for int values

2013-03-10 Thread eryksun
On Sun, Mar 10, 2013 at 4:57 AM, Vincent Balmori 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 d

Re: [Tutor] Use __str__ method for int values

2013-03-10 Thread Steven D'Aprano
On 10/03/13 19:57, Vincent Balmori wrote: I am trying to use a __str__ method to display the values of attribute mood = self.hunger + self. boredom. When I try to execute I get this error: Traceback (most recent call last): File "C:/Users/Vincent/Documents/Programming Tutorials/Python Progra

Re: [Tutor] Use __str__ method for int values

2013-03-10 Thread Timo
Op 10-03-13 09:57, Vincent Balmori schreef: I am trying to use a __str__ method to display the values of attribute mood = self.hunger + self. boredom. When I try to execute I get this error: Traceback (most recent call last): File "C:/Users/Vincent/Documents/Programming Tutorials/Python Prog

[Tutor] Use __str__ method for int values

2013-03-10 Thread Vincent Balmori
I am trying to use a __str__ method to display the values of attribute mood = self.hunger + self. boredom. When I try to execute I get this error: Traceback (most recent call last):   File "C:/Users/Vincent/Documents/Programming Tutorials/Python Programming for the Absolute Beginner - Project F