Instructions in book don't work
clp at jerf.org
Thu Jan 10 01:23:21 EST 2002
Dan Hamm <dan at dmhamm.org> wrote:
>>>> class Address:
> ... def _init_(self, Hs, St, Town, Zip):
> ... self.Hs_Number = Hs
> ... self.Street = St
> ... self.Town = Town
> ... self.Zip_Code = Zip
__init__ takes *two* underscores on each side, not just one.
(And as a style note, I'd recommend against such cryptic names...
"Hs_Number" actually took me a moment to figure out what it was!
Nothing wrong with "House_Number".)
> Traceback (most recent call last):
> File "<interactive input>", line 1, in ?
> TypeError: this constructor takes no arguments
Because you never changed the default __init__, which takes no arguments,
you got this message.
More information about the Python-list