Tried to rephrase my question to be less opinion based.
What are the downsides to pathlib.Path
object coerce/evaluate to False
when the filesystem path does not exist?
For example pathlib.Path could have been written with any __bool__
logic as it is just a Python class
class Path(object):
def __init__(self, path):
self.path_ = path
def __bool__(self):
return self.checkIfExistsOnFileSystemOrNot_()
def path(self):
return self.path_
def checkIfExistsOnFileSystemOrNot_(self):
# any logic here ...
...
I understand you might want to build up a filepath that is not "there" in a python program but when would you want to do
if path:
# do something with the path "assuming" it exits on the filesystem (and not just that it's not falsy)
I'll grant that
if path.exists():
# ...
Isn't that much more effort but given I've been jumping around between languages this has caused me some pain.