Instructions in book don't work

Derek Thomson derekt at dstc.qut.edu.au
Thu Jan 10 01:33:35 EST 2002


Hi Dan,

Dan Hamm wrote:

> This is my very first attempt at using a newsgroup, so please bear with 
> me. I am totally new to programming, and picked up the book "Lean to 
> Program Using Python" by Alan Gauld.


Welcome to coding in general and to Python in particular!

> The problem I am trying to solve is 
> this:
> 
>  
> 
> On page 51 the author shows demonstration code for setting up a class -
> 
>  
> 
>  >>> class Address:
> ...  def _init_(self, Hs, St, Town, Zip):


This must be:

...  def __init__(self, Hs, St, Town, Zip):

Note the *double* underscore before and after the string 'init'.
  If you fix this it works just fine.


Regards,
Derek.






More information about the Python-list mailing list