| Store | Cart

__getslice__ passed INT_MAX rather than sys.maxint for missing endpoint?

From: Dave Huang <k...@azeotrope.org>
Sat, 26 Mar 2005 08:29:46 GMT
Hi, I don't actually know Python; I'm just trying to debug a problem
I encounted in another program, so apologies if this has been
covered before. I did do some Google searches though, and didn't
find anything that specifically addressed this :)

According to the documentation at
<http://docs.python.org/ref/sequence-methods.html>, __getslice__
is passed sys.maxint for a missing endpoint (foo[i:]). However, as
far as I can tell, it's actually passing INT_MAX. I'm running Python
2.4 on an Alpha running NetBSD 2.0, an LP64 platform, so the two
aren't the same. INT_MAX is 2^32-1, whereas sys.maxint is LONG_MAX:

So, am I misunderstanding things, or is this a doc bug, or a code bug?

FWIW, the problem I encountered was some code that did something like:
    def __getslice__(self, a, b):
        if b == maxint:
            b = self.length  # this never got executed, causing problems
Name: Dave Huang         |  Mammal, mammal / their names are called /
INet: khym at azeotrope.org |  they raise a paw / the bat, the cat /
FurryMUCK: Dahan         |  dolphin and dog / koala bear and hog -- TMBG
Dahan: Hani G Y+C 29 Y++ L+++ W- C++ T++ A+ E+ S++ V++ F- Q+++ P+ B+ PA+ PL++

Recent Messages in this Thread
Dave Huang Mar 26, 2005 08:29 am
"Martin v. Löwis" Mar 27, 2005 11:10 am
Messages in this thread