<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'>
<br><br>&gt; Date: Thu, 23 Sep 2010 05:36:58 -0400<br>&gt; Subject: Re: [Tutor] pure function problem<br>&gt; From: jemejones@gmail.com<br>&gt; To: tutor@python.org<br>&gt; CC: rwobben@hotmail.com<br>&gt; <br>&gt; The problem is that your class definition doesn't do anything to<br>&gt; explicitly set those attributes.<br>&gt; <br>&gt; On Thu, Sep 23, 2010 at 4:58 AM, Roelof Wobben &lt;rwobben@hotmail.com&gt; wrote:<br>&gt; &lt;snip&gt;<br>&gt; &gt; class tijd :<br>&gt; &gt; &nbsp; &nbsp;pass<br>&gt; <br>&gt; You're not doing any explicit setting of attributes at the class level.<br>&gt; <br>&gt; &lt;snip&gt;<br>&gt; &gt; time = tijd()<br>&gt; &gt; time.hour = 20<br>&gt; &gt; time.minutes = 20<br>&gt; &gt; time.seconds = 20<br>&gt; <br>&gt; You set them on this instance.<br>&gt; <br>&gt; &gt; seconds = 20<br>&gt; &gt; uitkomst = tijd()<br>&gt; <br>&gt; But not on this one.<br>&gt; <br>&gt; What you probably want to do is something like this:<br>&gt; <br>&gt; class tijd(object):<br>&gt;     def __init__(self):<br>&gt;         self.hour = 20<br>&gt;         self.minutes = 20<br>&gt;         self.seconds = 20<br>&gt; <br>&gt; Or if you prefer to set these when you create the instance, you can<br>&gt; pass in values like this:<br>&gt; <br>&gt; class tijd(object):<br>&gt;     def __init__(self, hour=20, minutes=20, seconds=20):<br>&gt;         self.hour = hour<br>&gt;         self.minutes = minutes<br>&gt;         self.seconds = seconds<br>&gt; <br>&gt; I noticed something odd just a sec ago.  You have this:<br>&gt; &gt; uitkomst = tijd()<br>&gt; &gt; uitkomst = increment(time, seconds)<br>&gt; &gt; print uitkomst.minutes, uitkomst.seconds<br>&gt; <br>&gt; You're creating a tijd instance, binding uitkomst to it, then<br>&gt; overwriting that instance with what you return from increment().<br>&gt; <br>&gt; Anyway, hth.<br>&gt; <br>&gt; - jmj<br><br><br>Correct, <br><br>I try to find a way to solve this error message.<br><br>Roelof<br><br>                                               </body>
</html>