[Tutor] (no subject)

Alan Gauld alan.gauld at yahoo.co.uk
Wed Aug 16 21:16:19 EDT 2017


On 16/08/17 23:36, Howard Lawrence wrote:
> class Address:
>         def _init_(self,Hs,St,Town,Zip):
>                       self.HsNunber=Hs
>                       self.Street=St
>                       self.Town=Town
>                       self.Zip=Zip
> Addr=Address (7, ' high st', 'anytown', ' 123 456')

That looks suspiciously like my tutorial ;-)

The answer is to use two underscores around init():

def __init__(...)

not

def _init_(...)

This is explained in more detail in a box at the end
of the data topic:

http://www.alan-g.me.uk/l2p/tutdata.htm

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list