apply for objects
Greg Ewing
greg at cosc.canterbury.ac.nz
Mon Jun 26 21:50:05 EDT 2000
Sander Hahn wrote:
>
> >>> class C:
> def m(x, y):
> print str(x) + str(y)
>
>
> >>> c = C()
>
> >>> apply(c.m, ('hello', ' bye now'), {})
You didn't give your method a self argument:
class C:
def m(self, x, y):
print str(x) + str(y)
You will then be able to use apply() on it quite successfully.
--
Greg Ewing, Computer Science Dept,
+--------------------------------------+
University of Canterbury, | A citizen of NewZealandCorp, a |
Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. |
greg at cosc.canterbury.ac.nz +--------------------------------------+
More information about the Python-list
mailing list