by mamcx · 7y ago · 0 comments
config.load_from_file(....
And you can't know if it check if the file exist first or not. From pure habit you add checks... (what? looking at the code of the library? thats crazy!).It's an anti-pattern to throw errors for expected behavior.
On the other hand, non-atomically asking for permission first in any concurrent (or re-entrant!) context is not just an antipattern but simply wrong and always a possible race condition. It is impossible to write a routine that tries to open a file and is statically guaranteed to succeed.
[0] https://docs.quantifiedcode.com/python-anti-patterns/readabi...