Reading the language tututorial would help you a lot :(
=== what is the difference between pc and pc()?
pc = getToolByName(....) - returnes a refference to a method
Nope.
pc is a refference to a method,
Nope.
pc is not 'a reference to a method', it's a callable object (in this case a ZCatalog instance...)....
> pc() is a method invocation.
In this case, it happens to be a call to a method of ZCatalog, but it could have been a call to a named or anonymous function as well...
<op>
In Python, functions and methods are objects too, so you can use them like any other object :
def fun(): print "hello world"
machin = fun machin() >> hello world
But objects can be used like functions too, if they define a __call__ method:
class fakeFun(object): def __init__(self, name): self.name = name def __call__(self): return "hello, I'm %s" % self.name
f= fakeFun('foo') f() >> hello, I'm foo </op>
HTH Bruno -- http://mail.python.org/mailman/listinfo/python-list