Re: [web2py] Errors in web2py book

2010-09-12 Thread b vivek
Use this:- class MyList(object): def __init__(self, *a): self.a = list(a)#this has to be a list, was a tuple earlier def __len__(self): return len(self.a) def __getitem__(self, i): return self.a[i] def __setitem__(self, i, j): self.a[i] = j b=MyList(3,4,5) print b[1] b[1]=7#self-ex

[web2py] Errors in web2py book

2010-09-12 Thread guruyaya
In chapter 2, on the code example of "Special Attributes, Methods and Operators", we have class MyList(object) def __init__(self, *a): self.a = a def __len__(self): return len(self.a) def __getitem__(self, i): return self.a[i] def __setitem__(self, i, j): self.a[i] = j b = MyLi