On 3/28/2011 3:42 AM, Esben Nielsen wrote:
Hi,
We are making a prototype program in Python. I discovered the output was
non-deterministic, i.e. I rerun the program on the same input files and
get different output files. We do not use any random calls, nor
threading.
One of us thought it could be set and dictionaries not always yielding
the same results. I, however, would think that given the exact same
operations, a set/dictionary would always yield the same results. Am I
correct? Or could different runs of the same program yield different
results due to, say, different memory locations?
Are there any other sources of randomness we ought to look out for?
Esben
That's worth chasing down. It's hard to accidentally get
nondeterminism in a single-thread batch Python program.
Core Python doesn't have uninitialized variables, the usual
source of trouble, because Python variables are created by
initialization, not declaration.
numpy, though, does have uninitialized variables. Try:
import numpy
a = numpy.empty(10)
print(a)
creates an array of 10 junk floating point numbers. Look for that.
Also look at any other C packages you're using. If you're stil
stuck, give us the list of non-Python modules you're importing,
directly or indirectly.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list