numpy.load retrieves savez'ed arrays in the wrong order
<p>I am using numpy arrays that I store in a list. These arrays have no individual names, and I just call them by their index in the list.</p>

<p>I need to save and retrieve them all together, hence I used <code>numpy.savez</code> to store them into a single file. As my arrays are unnamed I just enumerated the list, and <code>numpy.savez</code> assigned them automatic names "arr_0", "arr_1", and so on.</p>

<p>But when I attempted to retrieve them all using <code>numpy.load</code> I discovered that <code>numpy.load</code> lists the arrays in a seemingly random order. Of course I can sort this list before restoring my arrays, but I find it quite strange that there is no straightforward way to store and retrieve an ordered list of unnamed arrays.</p>

<p>Here is a piece of test code to demonstrate the thing:</p>

<pre><code>import numpy as np

arr_list = []
for i in range(15):
    arr_list.append(np.array(range(i, i+6)).reshape(2, 3))

np.savez('testfile', *arr_list)
with np.load('testfile.npz') as data:
    print(data.files)
</code></pre>

<p>And here is what I get:</p>

<pre><code>&gt;&gt;&gt; ['arr_1', 'arr_3', 'arr_13', 'arr_11', 'arr_14', 'arr_10', 'arr_8', 'arr_0', 
     'arr_2', 'arr_9', 'arr_5', 'arr_4', 'arr_6', 'arr_12', 'arr_7']
</code></pre>

<p>What's more, I never get twice the same result. Next try:</p>

<pre><code>&gt;&gt;&gt; ['arr_6', 'arr_11', 'arr_10', 'arr_13', 'arr_0', 'arr_7', 'arr_5', 'arr_3', 
     'arr_14', 'arr_2', 'arr_8', 'arr_12', 'arr_1', 'arr_9', 'arr_4']
</code></pre>

<p>Unfortunately I cannot just sort the list using <code>sorted()</code>, as the result is not what I need (and this is why I gave an example with more than 10 items in the list):</p>

<pre><code>&gt;&gt;&gt; ['arr_0', 'arr_1', 'arr_10', 'arr_11', 'arr_12', 'arr_13', 'arr_14', 'arr_2', 
     'arr_3', 'arr_4', 'arr_5', 'arr_6', 'arr_7', 'arr_8', 'arr_9']
</code></pre>

<p>I can't figure out why <code>numpy.savez</code> + <code>numpy.load</code> gives such a strange behaviour. Did I miss something, or do I definitely have to use a regex to sort this out?</p>