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