Dave Huang wrote: > 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: > 2^64-1. > > So, am I misunderstanding things, or is this a doc bug, or a code bug?
It sounds like a code bug to me - raise it at: http://sourceforge.net/tracker/?group_id=5470&atid=105470 > 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 I presume that's actually: if b == sys.maxint: Anyway, the quick fix for this is: def __getslice__(self, a, b): b = min(b, len(self.length)) Tim Delaney -- http://mail.python.org/mailman/listinfo/python-list