0

I apologize, I still don't entirely understand classes in python. Anyway, I have a program like this:

class foo(args):
    def __init__(self):
         #stuff
         self.func(self, var)
    def func(self, var):
         return things(self, var)
def things(self, var):
    ##some stuff

My problem is that when I run this It says I am giving 3 arguments when it asks for 2. When I change things by getting rid of the self.func and putting func(self, var) instead, it says I am giving one variable too few. What is going on? Thanks in advance.

EDIT: Thanks for the answer cppcoder, but that doesn't help, because it just spits back saying there are too few args. I used a static variable instead of a function.

  • Make that call in your init `self.func(var)`. `func` is a bound method, `self` is implicitly provided as the first argument. – roippi Sep 30 '14 at 03:11

1 Answers1

1

self is an implicit argument and you need not provide it while invoking the function.
You can invoke as func(var)

You can read about this in What is the purpose of self?

Community
  • 1
  • 1
cppcoder
  • 22,227
  • 6
  • 56
  • 81