by makecheck · 7y ago · 0 comments
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...