[Tutor] Classses

Richard Gelling tombraider500@yahoo.co.uk
Fri, 24 May 2002 09:08:14 +0100 (GMT Daylight Time)


--------------Boundary-00=_QXVL6RO0000000000000
Content-Type: Text/Plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi,=0D
I am reading Alan Gauld and have got a bit stuck.I am up to reading about
classes and have typed in his example i.e=0D
=0D
class Address:=0D
           def _init_(self,Hs,Town,Zip)=0D
                  self.Hs_Number=3DHs=0D
                  self.Street=3DSt=0D
                  self.Town=3DTown=0D
                  self.Zip_Code=3DZip=0D
=0D
Which appears to work fine,however when type in the second part ie=0D
=0D
addr=3DAddress(7,"High St.","Anytown","12345")=0D
=0D
I get the error :=0D
=0D
Traceback (most recent call last):=0D
  File "<interactive input>", line 1, in ?=0D
TypeError: this constructor takes no arguments=0D
=0D
Could someone explain what is going wrong here.I am unable to see what i =
am
doing wrong.I have typed it in exactly as it is in the book and Have trie=
d
it on 2 working machines.I would be most grateful if someone could enligh=
ten
me,As i dont really want to continue until i see what i am doing wrong.=0D
=0D
=0D
Thanks a lot =0D
R.Gelling=0D
=0D
Registered Linux User : 256848
--------------Boundary-00=_QXVL6RO0000000000000
Content-Type: Text/HTML;
  charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Diso-885=
9-1"><html>
<head>
<meta name=3D"GENERATOR" content=3D"IncrediMail 1.0">
</head>

<BODY background=3D"" bgColor=3D#ffffff style=3D"BACKGROUND-POSITION: 0px=
 0px; FONT-SIZE: 10pt; MARGIN: 1px; FONT-FAMILY: Arial" scroll=3Dyes ORGY=
POS=3D"0">
<TABLE border=3D0 cellPadding=3D0 cellSpacing=3D0 id=3DINCREDIMAINTABLE w=
idth=3D"95%">
<TR>

<TD id=3DINCREDITEXTREGION width=3D"100%" style=3D"PADDING-RIGHT: 7px; PA=
DDING-LEFT: 7px; FONT-SIZE: 10pt; FONT-FAMILY: Arial"=20
   >
      <DIV>Hi,</DIV>
      <DIV>I am reading Alan Gauld and have got a bit stuck.I am up to re=
ading=20
      about classes and have typed in his example i.e</DIV>
      <DIV>&nbsp;</DIV>
      <DIV>class Address:</DIV>
      <DIV>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; def=20
      _init_(self,Hs,Town,Zip)</DIV>
      <DIV>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=20
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
      self.Hs_Number=3DHs</DIV>
      <DIV>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;=
&nbsp;=20
      &nbsp;&nbsp;&nbsp; self.Street=3DSt</DIV>
      <DIV>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=20
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.Town=3DTown</DIV>
      <DIV>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=20
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.Zip_Code=3DZip</DIV>
      <DIV>&nbsp;</DIV>
      <DIV>Which appears to work fine,however when type in the second par=
t=20
      ie</DIV>
      <DIV>&nbsp;</DIV>
      <DIV>addr=3DAddress(7,"High St.","Anytown","12345")</DIV>
      <DIV>&nbsp;</DIV>
      <DIV>I get the error :</DIV>
      <DIV>&nbsp;</DIV>
      <DIV>Traceback (most recent call last):<BR>&nbsp; File "&lt;interac=
tive=20
      input&gt;", line 1, in ?<BR>TypeError: this constructor takes no=20
      arguments</DIV>
      <DIV>&nbsp;</DIV>
      <DIV>Could someone explain what is going wrong here.I am unable to =
see=20
      what i am doing wrong.I have typed it in exactly as it is in the bo=
ok and=20
      Have tried it on 2 working machines.I would be most grateful if som=
eone=20
      could enlighten me,As i dont really want to continue until i see wh=
at i am=20
      doing wrong.</DIV>
      <DIV>&nbsp;</DIV>
      <DIV>&nbsp;</DIV>
      <DIV>Thanks a lot </DIV>
      <DIV>R.Gelling</DIV>
      <DIV>&nbsp;</DIV>
      <DIV>Registered Linux User : 256848</DIV></TD>
</TR>

<TR>
<TD id=3DINCREDIFOOTER width=3D"100%">

=09<TABLE cellPadding=3D0 cellSpacing=3D0 width=3D"100%">
=09<TR>
=09<TD width=3D"100%"></TD>
=09<TD align=3Dmiddle id=3DINCREDISOUND vAlign=3Dbottom></TD>
=09<TD align=3Dmiddle id=3DINCREDIANIM vAlign=3Dbottom></TD>
=09</TR>
=09</TABLE>

</TD>
</TR>

</TABLE>
</BODY>
</html>
--------------Boundary-00=_QXVL6RO0000000000000--



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com