In [7]: class y(str): ...: def __getslice__( self, start, end): ...: print "0x%08x 0x%08x" % (start, end) ...: ...: def __getitem__(self, index): ...: print "0x%08x" % index In [8]: x = y() In [10]: x[ 0x804dc340] 0x804dc340 In [14]: x[ 0x804dc34a:0x804dc34f] 0x7fffffff 0x7fffffff