Bug in string.find; was: Re: Proposed PEP: New style indexing,was Re: Bug in slice type

phil hunt zen19725 at zen.co.uk
Tue Aug 30 12:33:48 EDT 2005


On Tue, 30 Aug 2005 08:53:27 GMT, Bryan Olson <fakeaddress at nowhere.org> wrote:
>     Specifically, to support new-style slicing, a class that
>     accepts index or slice arguments to any of:
>
>         __getitem__
>         __setitem__
>         __delitem__
>         __getslice__
>         __setslice__
>         __delslice__
>
>     must also consistently implement:
>
>         __len__
>
>     Sane programmers already follow this rule.


Wouldn't it be more sensible to have an abstract IndexedCollection 
superclass, which imlements all the slicing stuff, then when someone 
writes their own collection class they just have to implement 
__len__ and __getitem__ and slicing works automatically?


-- 
Email: zen19725 at zen dot co dot uk





More information about the Python-list mailing list