python split array into runs/sequences - preferably numpy
<p>How can i split it into sequences/runs/subsequent-numbers, if the run is no longer than 3?</p>

<p>Having an array as follows</p>

<pre><code>[1, 2, 3, 5, 9, 10, 16, 17, 18, 19]
</code></pre>

<p>My expected output would be the following arrays:</p>

<ol>
<li><code>[1, 2, 3]</code></li>
<li><code>[5]</code></li>
<li><code>[9, 10]</code></li>
<li><code>[16, 17, 18]</code></li>
<li><code>[19]</code></li>
</ol>

<p>e.g. <code>[[1, 2, 3], [5], [9, 10], [16, 17, 18], [19]]</code></p>

<p>If it is a run of length 8 e.g. <code>[1, 2, 3, 4, 5, 6, 7, 8]</code> i would like to get <code>8 / 3 + 1 = 2</code> lists:</p>

<ol>
<li><code>[1, 2, 3]</code></li>
<li><code>[4, 5, 6]</code></li>
<li><code>[7, 8]</code></li>
</ol>