擅长:python、mysql、java
<blockquote>
<p>why there is no single operator to achieve that?</p>
</blockquote>
<p>自从Python的早期版本以来,列表切片的语法没有改变。原因可能是个人的判断或其他语言的影响。就是这样。我们必须学会接受它。你知道吗</p>
<blockquote>
<p>Is there any other way to easily achieve that functionality?</p>
</blockquote>
<p>好吧,当然。注<code>[]</code>是<code>__getitem__</code>的语法糖,<code>ind:ind+x</code>可以表示为<code>slice</code>对象。也许你更喜欢第二种变体?你知道吗</p>
<pre><code>L = list(range(10))
L[3:7] # [3, 4, 5, 6]
m, k = 3, 4
L.__getitem__(slice(m, m+k)) # [3, 4, 5, 6]
</code></pre>