osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why exception from os.path.exists()?


Antoon Pardon <antoon.pardon at vub.be>:

> On 08-06-18 09:45, Marko Rauhamaa wrote:
>> Whatever your philosophical tastes, this unexpected feature of
>> os.path.exists() (& co) leads to unexpected application behavior IRL,
>> and, in the GhostBusters sense, that is bad.
>
> Sure, I agree that it is unexpected behaviour. But does that mean the
> behaviour should be fixed or that the behaviour should be better
> documented?

I'd say it should be fixed. I would go so far as to say that os.stat()
should be fixed so that "" and "\0" result in the same exception (EINVAL
~ ValueError).

If the documentation option is taken, the documentation should emphasize
the issue. Furthermore, the http.server module should be fixed because
it is broken at the moment.


Marko