Como prender um inteiro a algum alcance?

tenho o seguinte código: new_index = index + offset if new_index < 0: new_index = 0 if new_index >= len(myl ... Se eu digitar mal. Por outras palavras, não me parece muito simples. new_index = max(0, min(new_index, len(mylist)-1))