[Tutor] Classses

Jeff Shannon jeff@ccvcorp.com
Fri, 24 May 2002 09:56:48 -0700


Richard Gelling wrote:

 > class Address:>            def
_init_(self,Hs,Town,Zip)>
self.Hs_Number=Hs>                   self.Street=St>
self.Town=Town>                   self.Zip_Code=Zip>> Which appears to
work fine,however when type in the second part ie>>
addr=Address(7,"High St.","Anytown","12345")> [...]

Others have already pointed out your problem with _init_ versus
__init__, but I wanted to mention that you've got another bug lurking
here.  In your constructor, you have the line "self.Street = St" ...
but you don't have St in your argument list!  So, when you fix your
underscores and run this again, you'll still get an error, saying that
the constructor takes exactly four arguments (five given).

Jeff Shannon
Technician/Programmer
Credit International