[docs] [issue21785] __getitem__ and __setitem__ try to be smart when invoked with negative slice indices

Konstantin Tretyakov report at bugs.python.org
Tue Jun 17 09:54:58 CEST 2014


Konstantin Tretyakov added the comment:

Do note that things are not as simple as "slices with negative indices are treated differently from scalar negative indicies".

Namely, behaviour differs whether you use [] or .__getitem__, and whether you use [a:b] or [slice(a,b)]. This does not make sense from a specification perspective, but has to be made clear in the docs then.

Besides, Jython does not have this problem and I presume other Python implementations might also be fine (e.g. PyPy or whatever else there exists, couldn't test now).

Hence, although fixing the docs does seem like a simple solution, if you want to regard the docs as a "specification of the Python language" rather than a list of particular CPython features, this won't be reasonable.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21785>
_______________________________________


More information about the docs mailing list