Why exception from os.path.exists()?
On 08-06-18 13:35, Steven D'Aprano wrote:
> 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
> Pretty pathetic really.
Get of your high horse. Sure I was too quick in my reaction, without
reading your contribution through. That is regretable but it happens.
But you are in no situation to cast the first stone. These things
and worse have been happening to you too.
> 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.
Only if you phrase the question as being about eliminating an exception.
If you phrase the question as being about how invalid pathnames should
be treated and may consider that they all should raise an exception then
ASCIIZ is relevant as an illustration of what is in some situation an invalid