<p>位于<a href="http://docs.python.org/reference/expressions.html#slicings" rel="nofollow">http://docs.python.org/reference/expressions.html#slicings</a>的文档说(有一些摘录):</p>
<blockquote>
<p><strong>5.3.3. Slicings</strong></p>
<p>A slicing selects a range of items in a <strong>sequence object</strong> (e.g., a string, tuple or list). </p>
</blockquote>
<pre><code>slicing ::= simple_slicing | extended_slicing
simple_slicing ::= primary "[" short_slice "]"
extended_slicing ::= primary "[" slice_list "]"
slice_list ::= slice_item ("," slice_item)* [","]
slice_item ::= expression | proper_slice | ellipsis
proper_slice ::= short_slice | long_slice
short_slice ::= [lower_bound] ":" [upper_bound]
long_slice ::= short_slice ":" [stride]
lower_bound ::= expression
upper_bound ::= expression
stride ::= expression
ellipsis ::= "..."
</code></pre>
<blockquote>
<p>The semantics for a simple slicing are as follows. The primary must evaluate to a <strong>sequence object</strong>...</p>
<p>The semantics for an extended slicing are as follows. The primary must evaluate to a <strong>mapping object</strong>, ...</p>
</blockquote>
<p><strong>问题:</strong></p>
<p>为了支持<code>[1,2,3][a:b:c]</code>符号,语言引用要求<strong>列表</strong>是<strong>映射对象</strong>(<code>stride</code>只有“扩展切片”才存在,这是用于映射对象的)。那么,语言引用是否中断了(可能他们只是在引入<a href="http://docs.python.org/release/2.3.5/whatsnew/section-slices.html" rel="nofollow">What's New in Python2.3: Extended Slices </a>时忘了更新它?)?在</p>
<p>此外,切片显然不仅仅适用于序列对象(参见上面的第一个短语)。在</p>
<p>还是只有我?;)</p>
<p><strong>p.S.</strong></p>
<p>有趣的是,python3文档在<a href="http://docs.python.org/release/3.1.3/reference/expressions.html#slicings" rel="nofollow">http://docs.python.org/release/3.1.3/reference/expressions.html#slicings</a>上说:</p>
<blockquote>
<p>A slicing selects a range of items in a <strong>sequence object</strong> (e.g., a string, tuple or
list)...</p>
<p>[<em>"unified" slicing definition, not differentiating between "exteneded" and "simple" here</em>]</p>
<p>The semantics for a slicing are as follows. The primary must evaluate to a <strong>mapping object</strong>, ...</p>
</blockquote>