Non-deterministic output

2011-03-28 Thread Esben Nielsen
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

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Non-deterministic output

2011-03-29 Thread Esben Nielsen

On Mon, 2011-03-28 at 12:58 +0100, Tim Wintle wrote:
> On Mon, 2011-03-28 at 12:42 +0200, Esben Nielsen wrote:
> > 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?
> 
> If you're using id() at any point (e.g. in __hash__ ) then that would
> lead to non-deterministic behaviour.
> 
I changed my code to use other kinds of hash. That helped! :-) Thanks!

> obviously so would time.time() etc.

I didn't use those :-)
> 
> 

Esben



-- 
http://mail.python.org/mailman/listinfo/python-list