def decode_slice(slc):
 ret = []
 for x in (slc.start, slc.stop, slc.step):
  if hasattr(x, '__index__'):
   x = x.__index__()
  ret.append(x)
 return tuple(ret)

def decode_slice ( slc ) : ret = [ ] for x in ( slc . start , slc . stop , slc . step ) : if hasattr ( x , '__index__' ) : x = x . __index__ ( ) ret . append ( x ) return tuple ( ret )
decode a slice object as sent to __getitem__ .