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@python
components: Documentation
messages: 237947
nosy: docs@python, gdementen
priority: normal
severity: normal
status: open
title: Incorrect doc for __getslice__
versions: Python 2.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23645>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to