How does "for" work?

Michal Wallace sabren at manifestation.com
Tue Oct 10 14:52:47 EDT 2000


On Tue, 10 Oct 2000, Steve Juranich wrote:

> I have an object that is actually just a list of other, smaller items.
> 
> In the list object, I have overridden __getitem__ to be the following:
> 
> def __getitem__(self, key):
>     return self.data[key]


look at the UserList module...

I believe you need to raise an IndexError when you get to the
end of the list..


Cheers,

- Michal
------------------------------------------------------------------------
www.manifestation.com  www.sabren.com  www.linkwatcher.com  www.zike.net
------------------------------------------------------------------------





More information about the Python-list mailing list