A bundle of questions from a Python newbie
jeff at ccvcorp.com
Thu Feb 21 13:56:17 EST 2002
Hans Nowak wrote:
> "Gonçalo Rodrigues" wrote:
> > 10. I have a class that works like a list in the sense that supports the
> > method __getitem__ and its relatives. But I'm at a loss as to what I
> > have to do to support the slice notation.
> __getitem__(self, x) will be called with a so-called slice
> object if you call your instance with the slice notation.
IIRC, Slice objects (types.SliceType, etc) are deprecated, and objects wishing
to use slice notation should use __getslice__() and __setslice__() [and,
perhaps, __delslice__()] instead.
More information about the Python-list