[Tutor] functions and errors

Hans Nowak roodbaard@earthlink.net
Wed, 22 May 2002 11:47:32 -0400


On 22 May 2002, at 15:33, Terje Johan Abrahamsen wrote:

> class accountcurrents:
>     #xlApp = Dispatch("Excel.Application")
>     #ex = Dispatch("Extra.System")
>     #xlApp.Visible = 1
>     #xlApp.Workbooks.Add()
>     #xlBook = xlApp.Workbooks(1)
>     #xlSheet = xlApp.Sheets(1)
> 
>     def __init__(self):
>         print"Hello"
> 
>     def finnxlpolicy():
>         print"world"

You forgot the 'self':

    def finnxlpolicy(self):
        print "world"

Method definitions should always have at least one argument, usually called 
"self".

See also:
  
http://www.python.org/doc/current/tut/node11.html#SECTION0011400000000000000000

HTH,

--Hans Nowak (roodbaard@earthlink.net)
http://www.awaretek.com/nowak/