Barry Scott <ba...@barrys-emacs.org>:
> I think the rule is, if python can pass the string faithfully to the
> OS, then do so, otherwise raise an exception that tells the programmer
> that they are doing something that the OS does not allow for.

Sure, but few application programmers would think of dealing with the
surprising ValueError. If they did, they wouldn't think os.path.exists()
had any usefulness. Why write:

    try:
        ex = os.path.exists(path)
    except ValueError:
        ex = False
    if not ex:
        ...

instead of:

    try:
        os.stat(path)
    except (OSError, ValueError):
        ...


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to