Why exception from os.path.exists()?

Steven D'Aprano steve+comp.lang.python at pearwood.info
Fri Jun 8 07:35:09 EDT 2018


On Fri, 08 Jun 2018 09:27:17 +0200, Antoon Pardon wrote:

> On 08-06-18 04:19, Steven D'Aprano wrote:
>> On Thu, 07 Jun 2018 17:45:06 +1000, Chris Angelico wrote:
>>
>>> So... an ASCIIZ string *can* contain that character, or at least a
>>> representation of it. Yet it cannot contain "\0".
>> You keep saying that as if it made one whit of difference to what
>> os.path.exists should do. I completely agree that ASCIIZ strings cannot
>> contain NUL bytes. What does that have to do with os.path.exists()?
>>
>> NTFS file systems use UTF-16 encoded strings. For typical mostly-ASCII
>> pathnames, the bytes on disk are *full* of NUL bytes.
> 
> This is irrelevant.

Of course it is irrelevant, JUST LIKE I SAID IN THE PARAGRAPH YOU DELETED:

    They're actually both equally implementation details and 
    utterly irrelevant to the behaviour of os.path.exists.

(referring to both the NUL bytes in UTF-16 encoded NTFS file names, and 
the lack of NUL bytes in common Linux file names).

I think that's dirty debating tactics, a variant of "Strawman argument". 
I make a statement. You delete it, and respond saying the same thing I 
said, but making it out as if it were a devastating response to my 
argument.

Pretty pathetic really.

The existence or use of ASCIIZ strings by the Linux kernel are not the 
least bit relevant to the question of why, alone of a near-infinite 
number of possible invalid pathnames, those containing NUL are singled 
out for an exception when all others simply return False.



-- 
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