title: What could be the possible cause of two identical Python files behaving differently when run?
body: <p>I'm running an iterative algorithm. I'm comparing two identical implementations of it, in two different files which are copy-pasted versions of each other, but in different subdirectories. Yet I consistently get different results, one file (the same one) always takes fewer steps to converge. You can see the comparison of five runs for each file here:</p>
  <p><a href="https://i.stack.imgur.com/69zVI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/69zVI.png" alt="enter image description here" /></a></p>
  <p>The blue one should be the same as the green one (or at least vice versa).</p>
  <ul>
  <li>the code in both files: <a href="https://gist.github.com/corazza/a945a6d7929341818e19261f568c4eb5#file-gistfile1-py" rel="nofollow noreferrer">https://gist.github.com/corazza/a945a6d7929341818e19261f568c4eb5#file-gistfile1-py</a></li>
  <li>diff of <code>globals()</code> output when I embed an IPython shell during runs for both files: <a href="https://www.diffchecker.com/i6TcIndO" rel="nofollow noreferrer">https://www.diffchecker.com/i6TcIndO</a></li>
  </ul>
  <p>As you can see in the <code>globals()</code> diff, the only difference is in the module name (because they're different files in different subdirectories), and at the end there is also difference in fully qualified names of two functions, but those functions are what the files consist of and they are copy-pasted so identical. Other functions and constants in the namespace are identical.</p>
  <p>I'm all out of ideas of what could even be a possible cause of this behavior, does anyone have any candidates?</p>