Rationale behind the deprecation of __getslice__?
Carl Banks
imbosol at aerojockey.com
Thu Dec 9 18:11:25 EST 2004
Steven Bethard wrote:
> Unfortunately, I don't think __getslice__ can be removed from list
(and
> str and tuple) because of backwards compatibility constraints...
Wouldn't it work to have __getslice__ call __getitem__? And, since
that would be too much of a performance hit, have it check whether its
type is list (or str or tuple), and only call __getitem__ if it is not
(i.e., only for subclasses). I don't think that would be too bad.
Subclasses would still be free to override __getslice__, but wouldn't
have to.
--
CARL BANKS
More information about the Python-list
mailing list