Non-deterministic output

Tim Wintle tim.wintle at teamrubber.com
Mon Mar 28 07:58:22 EDT 2011


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.

obviously so would time.time() etc.





More information about the Python-list mailing list