[docs] [issue23645] Incorrect doc for __getslice__

Gaëtan de Menten report at bugs.python.org
Thu Mar 12 16:24:36 CET 2015


New submission from Gaëtan de Menten:

The documentation for __getslice__ at https://docs.python.org/2/reference/datamodel.html#object.__getslice__ states: "Note that missing i or j in the slice expression are replaced by zero or sys.maxint, respectively."

However, in practice, it seems like it is replaced by sys.maxsize instead. This is obviously only a problem for 64bit versions of Python 2 since sys.maxint and sys.maxsize are the same on 32bit Python.

In [1]: class A(object):
   ...:     def __getslice__(self, i, j):
   ...:         print i, j
   ...:

In [2]: a = A()

In [3]: a[:]
0 9223372036854775807

In [4]: import sys

In [5]: sys.maxint
Out[5]: 2147483647

In [6]: sys.maxsize
Out[6]: 9223372036854775807L

In [7]: sys.version
Out[7]: '2.7.9 |Continuum Analytics, Inc.| (default, Dec 18 2014, 16:57:52) [MSC v.1500 64 bit (AMD64)]'

----------
assignee: docs at python
components: Documentation
messages: 237947
nosy: docs at python, gdementen
priority: normal
severity: normal
status: open
title: Incorrect doc for __getslice__
versions: Python 2.7

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


More information about the docs mailing list