confused about why i get a type error when i call an object's method

2007-08-21 Thread pepper
I'm confused about why i get a type error when i call an object's
method.  Here's the example code:
>>> class Foo:
def __init__(self):
self.foo = []
def foo(self):
print "in foo!"


>>> f = Foo()
>>> dir(f)
['__doc__', '__init__', '__module__', 'foo']
>>> f.foo()

Traceback (most recent call last):
  File "", line 1, in 
f.foo()
TypeError: 'list' object is not callable
>>>

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


Re: confused about why i get a type error when i call an object's method

2007-08-21 Thread pepper
Ha!  I knew it was obvious.  Thank you.


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