python can't count!
Christopher Koppler
klapotec at chello.at
Thu Oct 2 11:13:33 EDT 2003
On 2 Oct 2003 08:02:48 -0700, dokaspar at student.ethz.ch (Dominik
Kaspar) wrote:
>hello
>
>i'm wondering if i'm just too stupid for python or if i've missed
>something fundamentally important of its semantics.
>Why does the following program result in the TypeError: print_it()
>takes exactly 1 argument (2 given)?
>I don't see any function passing or receiving 2 arguments here... am i
>blind?
>
>import threading
>
>class Server(threading.Thread):
> def print_it(n):
> print n
>
> def run(self):
> self.print_it(34)
> while 1:
> pass
>
>s = Server()
>s.start()
You're calling print_it as an instance method, and thus should have
def'd it as print_it(self, n)
--Christopher
More information about the Python-list
mailing list