Increment slice object?
<p>Is it possible to change the values in a python slice object?</p>

<p>For example, if I have </p>

<pre><code>slice(0,1,None)
</code></pre>

<p>How would I, in effect, add 1 to the start and end values and so convert this to:</p>

<pre><code>slice(1,2,None)
</code></pre>

<p>Not exactly elegant, but it works:</p>

<pre><code>&gt;&gt;&gt; s1 = slice(0,1,None)
&gt;&gt;&gt; s2 = slice(s1.start + 1, s1.stop + 1, s1.step)
&gt;&gt;&gt; s2
slice(1, 2, None)
&gt;&gt;&gt; 
</code></pre>

python slice