[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyKDE] A simple PyQt program
From: Gordon Tyler <gordon () doxxx ! net>
Date: 2004-06-27 4:14:20
Message-ID: 40DE499C.1060107 () doxxx ! net
[Download RAW message or body]
Joshua wrote:
> TypeError: update() takes exactly 2 arguments (3 given)
>
> I don't understand this, since I only gave update 2 arguments. If anyone
> could shed some light on this, I'd greatly appreciate it. Here's the code:
This is something fairly fundamental to Python programming, so you have
to make sure that you understand how this works.
When you have a class with a method:
class Foo:
def bar(self, x):
print x
And you call that method on an instance of the class:
f = Foo()
f.bar("abc")
The instance, f, is automatically passed as the first argument to the
function before any other arguments that are provided in the call.
Therefore, when you declare methods in a class they must have a "self"
parameter as the first parameter.
There's more to this than I've explained here so you should read a
Python book or online manual.
Ciao,
Gordon
_______________________________________________
PyKDE mailing list PyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic