Non-deterministic output
Esben Nielsen
esn at terma.com
Tue Mar 29 03:32:34 EDT 2011
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
More information about the Python-list
mailing list