[Python-Dev] Ranges

Moshe Zadka Moshe Zadka <moshez@math.huji.ac.il>
Thu, 13 Jul 2000 10:46:31 +0300 (IDT)


On Wed, 12 Jul 2000, Ka-Ping Yee wrote:

> I believe the two possibilities were
> 
>     __getitem__ gets either an index or a special slice object
>     __getslice__ is deprecated (when missing, __getitem__ gets the slice args)
> 
> and
> 
>     __getitem__ always gets an index
>     __getslice__ gets three arguments, all optional, defaulting to None
> 
> The latter isn't backward-compatible, but it makes a heckuva lot
> more sense.

Right. I'd be +1 on the latter if we didn't have to be backwards
compatible. OTOH: How many people do you know who deal with slices in
__getitem__, besides the numpy people?

--
Moshe Zadka <moshez@math.huji.ac.il>
There is no GOD but Python, and HTTP is its prophet.
http://advogato.org/person/moshez