Why exception from os.path.exists()?

Steven D'Aprano steve+comp.lang.python at pearwood.info
Mon Jun 11 07:59:05 EDT 2018


On Mon, 11 Jun 2018 09:55:06 +0200, Antoon Pardon wrote:

> On 11-06-18 02:28, Steven D'Aprano wrote:
[...]
>>     open(foo) raises an exception if foo doesn't exist;
>>
>>     os.path.exists(foo) returns False if foo doesn't exist.
> 
> That is not correct. The path can exist and os.path.exists still return
> False.

It is correct. I made no claim about what happens if foo exists. I said 
only that if it doesn't exist, the function returns False.

If you're going to be pedantic, be *right*. Being pedantically wrong is 
just sad.




-- 
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson




More information about the Python-list mailing list