Passing Too Many Arguments to Object Method - Python
<p>So I think I have an incredibly simple case but I'm utterly lost about why it won't execute.</p>

<p>Here's my source - this is my main.py file that I'm running by just executing 'python main.py' from the command line:</p>

<pre><code>import player
import enemy

p1 = player.playerClass(health = 200.0, position = [1, 0, 0], damage = 30.0)
e1 = enemy.enemyClass(position = [3, 0, 0], damage = 35.0)

print("Before attacking: " + str(e1.Health))
p1.Attack(e1, p1.Damage) # Error is here
print("After attacking: " + str(e1.Health))
</code></pre>

<p>The code for the Attack method is found within the playerClass class. The enemyClass is exactly the same without the Attack() method (trying to keep everything as simple as possible)</p>

<pre><code>import character

class playerClass(character.CharacterBaseClass): # derived class used to contain an 'Attack' method, but does not anymore

    def __init__(self, health = 100.0, position = [0, 0, 0], damage = 10.0):
        self.Health = health
        self.pos = position
        self.Damage = damage

    def Attack(self, target):
        self.CurrentTarget = target
        target.Health -= self.Damage
        self.CurrentTarget = None
</code></pre>

<p>From what I've been reading, I've applied the 'self' keyword to the class definition of Attack, and 'p1' should be being passed as such when 'p1.Attack(...)' is called, but for some reason I'm getting the error:</p>

<pre><code>TypeError: Attack() takes exactly 2 arguments (3 given)
</code></pre>

<p>Any suggestions on what I'm missing? I know there are some related questions about the same issue but those questions explain <em>why</em> 'self' is needed, which I already (sort of) get.</p>