ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Lorenz's answer is correct; whenever you use brackets, it tries to call the function immediately, which isn't what you are trying to do.
In terms of arguments to the function, you don't need to bother passing in the 'self' argument, it is automatically done for you. self.callback is a bound method - it already contains a reference to the scope that it is bound to (saved in the __self__ variable). So you never need to provide the self argument, regardless of where you call the method.
As an aside,
If you do want to do partial functions, you can do so using functools.partial. Here's an example:
from functools import partial
def jon(a, b):
print "a is", a
print "b is", b
partialjon = partial(jon, "part of the partial function...")
partialjon("not.")
>> a is part of the partial function...
>> b is not.
http://docs.python.org/library/functools.html#functools.partial