Reply to post: Re: "the order in which files get compared affects the results"

Chemists bitten by Python scripts: How different OSes produced different results during test number-crunching

Frumious Bandersnatch

Re: "the order in which files get compared affects the results"

The use of Python seems immaterial to this

I think not, actually. As it happens, by chance (not related to reading the article), last night I was looking at a similar bit of code that I wrote in Perl a while back. I was worried that the output of Perl's sort routine would vary depending on the locale in use. After checking the documentation, it seems that it doesn't. It uses the standard C locale, and you have to explicitly add a pragma (well, "use" line) if you want lexicographical sort order. That is, if you want "Adam" and "adamant" to sort next to each other. Fortunately, it seems like my code didn't have this bug.

So where I'm going is that it's actually a Python problem rather than an OS problem. Or just a "programmer failing to read the manual" problem, but I think that you can also blame the design of the language routine for not producing deterministic output by default...

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon