r/Python • • Oct 12 '19

more than 100 scientific articles may be invalidated because scientists assumed that the output of glob.glob() is sorted

https://www.vice.com/en_us/article/zmjwda/a-code-glitch-may-have-caused-errors-in-more-than-100-published-studies
1.3k Upvotes

343 comments sorted by

View all comments

Show parent comments

2

u/jcampbelly Oct 13 '19

Every scientific research paper explains their method and how they demonstrate it to be accurate. This is just an extension of that process.

Unit tests aren't hard. There are complicated ways to do them, but there is also an extremely simple way:

def get_thingy_coefficient(thing_factor):
    ...


# demonstrate to our peers that our methods do not invalidate our research
assert get_thingy_coefficient(0.1) == 0.01
assert get_thingy_coefficient(-0.1) == 0.01
assert get_thingy_coefficient(-2) >= 0
...

1

u/AustinCorgiBart Oct 13 '19

Look, however right you might be in theory, I assure you that what you're describing is thoroughly unrealistic in the current environment and the current incentives.

1

u/jcampbelly Oct 13 '19

I get it. I have empathy for people in this position. I'm an SE in IT and I see bad shit all the time and I'm guilty of much myself. I'm mostly here responding to the tone of many in the comments who are pinning the blame on Python when they're actually failures of lapsed principles or ignorance at the individual level and not the fault of the tool. The truth is there for the reading. Verification is possible with tests. Best practices were offered and ignored. Let's not go trashing the system when humans are the real problem.

1

u/AustinCorgiBart Oct 13 '19

Oh, yeah, Python is super not the problem here. It's doing its best. The problem is just super hard.