Python language/syntax usage
<p>New to python but ran into something I don't understand.  The following line of code:</p>

<pre><code>diff = features[0:] - test[0]    # &lt;- this is what I don't get
</code></pre>

<p>is used thusly:</p>

<pre><code>x = diff[i] 
</code></pre>

<p>to return the element-wise difference between <code>features[i]</code> and <code>test[0]</code>.  Can anyone point to a language reference for this or explain it?  I understand how the result can be developed using "def" or "lambda" but I don't understand the construction.</p>

<p>thanks!</p>

<p>the answer depends on what <code>features[0:]</code> and <code>test[0]</code> evaluate to. 
if <code>test[0]</code> is a number and <code>features[0:]</code> is a numpy array, then you may be using numpy to subtract a number from each element in a list:  </p>

<pre><code>&gt;&gt;&gt; import numpy
&gt;&gt;&gt; array = numpy.array([49, 51, 53, 56])
&gt;&gt;&gt; array - 13
array([36, 38, 40, 43])
</code></pre>

python