[EMAIL PROTECTED] wrote:

> I wrote a small class today at work playing with sockets in command
> line windows. When attempting to call the handle function, I get a
> TypeError.  "Unbound method handle() must be called with connection
> instance as first argument (got nothing instead).  Any suggestions
> would be greatly appreciated.  Thanks!

That happens if you call a (normal) method on the class instead of on an
instance.

>>> class A:
...     def method(self, *args): print args
...

This works:

>>> A().method(42)
(42,)

while this doesn't:

>>> A.method(42)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: unbound method method() must be called with A instance as first
argument (got int instance instead)

For details you need to post some code illustrating the problem.

Peter
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to