def decrementAny(tup):
 res = []
 for (i, x) in enumerate(tup):
  if (x > 0):
   res.append(tuple(((list(tup[:i]) + [(x - 1)]) + list(tup[(i + 1):]))))
 return res

def decrementAny ( tup ) : res = [ ] for ( i , x ) in enumerate ( tup ) : if ( x > 0 ) : res . append ( tuple ( ( ( list ( tup [ : i ] ) + [ ( x - 1 ) ] ) + list ( tup [ ( i + 1 ) : ] ) ) ) ) return res
the closest tuples to tup: decrementing by 1 along any dimension .