[albatross-users] Having trouble implementing pagination

Damien Elmes alb-users at repose.cx
Tue Sep 30 17:47:01 EST 2003


Sheila King <sheila at thinkspot.net> writes:

> I tried this:
>
> class myclass(list):
>     def __getitem__(self, x):
>         return self[x]

If you're inheriting from list, getitem should be defined already. ie:

>>> class mylist(list):
...     pass
... 
>>> m = mylist([1,2,3])
>>> m[2]
3

If you really wanted to do getitem manually, you'd want to call the
super function - ie, 

list.__getitem__(self, x)

If you were only creating a custom class for the purposes of
providing those methods, you can probably skip it and just use a
standard list (but I haven't played with albatross's pagination
support before).

Cheers,
-- 
Damien Elmes



More information about the Albatross-users mailing list