Message237947
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)]' |
|
Date |
User |
Action |
Args |
2015-03-12 15:24:36 | gdementen | set | recipients:
+ gdementen, docs@python |
2015-03-12 15:24:36 | gdementen | set | messageid: <1426173876.09.0.220076074076.issue23645@psf.upfronthosting.co.za> |
2015-03-12 15:24:35 | gdementen | link | issue23645 messages |
2015-03-12 15:24:35 | gdementen | create | |
|