3 ms·
> Obviously reliable sorting is important, which is why people are upset that python's glob() turned out to be unreliable A quick glance at the documentation d
by luckylion 7y ago
> Obviously reliable sorting is important, which is why people are upset that python's glob() turned out to be unreliable
A quick glance at the documentation didn't mention it, does glob even promise sorting the result? Relying on that to happen when it's not even promised seems negligent.
- magicbuzz 7y agoMost developers look at the result from a function call rather than looking at the documentation.
- perl4ever 7y agoI mean, I have learned that people simply won't accept that SQL doesn't guarantee the order of a result set if you don't use "order by". I tried to argue it and eventually gave up. It seems vastly easier to change a language than human nature. People are hardwired to ignore claims that something should not be relied on, because in normal human relations, that is a way of pushing away undue responsibility, not something to be taken literally.
- bmc7505 7y ago> A quick glance at the documentation didn't mention it What do you mean? It is the very first sentence of the documentation: "results are returned in arbitrary order" https://docs.python.org/2/library/glob.html https://docs.python.org/2/library/glob.html
- luckylion 7y agoAh, see, I missed that, I had just skimmed, then grepped for "sort" and "order" (but mistyped that as oder).
- emmelaich 7y agoIt doesn't sort. But people assume it does especially if the files are returned in the order that they were created, which typically will be sorted. I think this is why it doesn't get noticed; the files are written say result-20190901-1303 result-20190901-1305 result-20190901-1310 etc...