On Thu, 08 Feb 2007 03:00:39 -0800, king kikapu wrote:

>> def modify(list_of_x):
>>     for x in list_of_x:
>>         try:
>>             x.change_in_place  # don't call the method, just check it exists
> 
> XXmmmm...what exactly is going on here ? I mean, what is actually
> happens if you omit the parenethesis as you just did ? I understand
> that it does not call the method, but what is really doing ??

The same as for any attribute: x.name gives the object referred to by the
attribute name, and x.name() calls that object.

He's a simple example:

>>> def foo():
...     return "foo"
...
>>> type(foo)  # the name alone
<type 'function'>
>>> type(foo())  # call the function
<type 'str'>


-- 
Steven.

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

Reply via email to