Re: AttributeError: ClassA instance has no attribute '__len__'

2005-03-30 Thread [EMAIL PROTECTED]
ine 10, in ? print len (a) AttributeError: classA instance has no attribute '__len__' You can fix it by adding a __len__ method: class classA: def __init__(self): pass def __len__(self): return 0 a = classA() print len (a) See http://docs.python.org/ref

Re: AttributeError: ClassA instance has no attribute '__len__'

2005-03-30 Thread vincent wehren
"MackS" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED] | I'm new to Python. In general I manage to understand what is happening | when things go wrong. However, the small program I am writing now fails | with the following message: | | AttributeError: C

Re: AttributeError: ClassA instance has no attribute '__len__'

2005-03-30 Thread Michael Spencer
s the problem and include the actual traceback. However... AttributeError: ClassA instance has no attribute '__len__' Following the traceback,I see that the offending line is self.x = arg1 + len(self.y) + 1 len calls the object's __len__ method. self.y is bound to something (an

AttributeError: ClassA instance has no attribute '__len__'

2005-03-30 Thread MackS
I'm new to Python. In general I manage to understand what is happening when things go wrong. However, the small program I am writing now fails with the following message: AttributeError: ClassA instance has no attribute '__len__' Following the traceback,I see that the offending