how does pickle know which to pick?
<p>I have my pickle function working properly</p>

<pre><code>    with open(self._prepared_data_location_scalar, 'wb') as output:
        # company1 = Company('banana', 40)
        pickle.dump(X_scaler, output, pickle.HIGHEST_PROTOCOL)
        pickle.dump(Y_scaler, output, pickle.HIGHEST_PROTOCOL)


    with open(self._prepared_data_location_scalar, 'rb') as input_f:
        X_scaler = pickle.load(input_f)
        Y_scaler = pickle.load(input_f)
</code></pre>

<p>However, I am very curious how does pickle know which to load? Does it mean that everything has to be in the same sequence?</p>

<p>wow I did not even know you could do this ... and I have been using python for a very long time... so thats totally awesome in my book,  however you really should not do this it will be very hard to work with later(especially if it isnt you working on it)</p>

<p>I would recommend just doing  </p>

<pre><code>pickle.dump({"X":X_scalar,"Y":Y_scalar},output)

 ...
data = pickle.load(fp)
print "Y_scalar:",data['Y']
print "X_scalar:",data['X']
</code></pre>

<p>unless you have a <strong>very</strong> compelling reason to save and load the data like you were in your question ...</p>

<h1>edit to answer the actual question...</h1>

<p>it loads from the start of the file to the end (ie it loads them in the same order they were dumped)</p>

python pickle