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
"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
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
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