Why does pathlib not have is_readable() & things like that?

Adam Funk a24061 at ducksburg.com
Thu Apr 28 09:02:51 EDT 2016


On 2016-04-26, Random832 wrote:

> On Tue, Apr 26, 2016, at 09:30, Adam Funk wrote:
>> I recently discovered pathlib in the Python 3 standard library, & find
>> it very useful, but I'm a bit surprised that it doesn't offer things
>> like is_readable() and is_writable.  Is there a good reason for that?
>
> Well, one reason would be EAFP. Just try to open the file and see if it
> gives you a PermissionError.

I understand that in general, but the tool I'm working on here takes a
command-line option to specify an output directory, & I'd rather not
start processing the data (which involves GETting from a REST service,
processing, and PUTting back modifications to the data) only to crash
after the first batch because of a user error.


-- 
Specifications are for the weak & timid!
          --- Klingon Programmer's Guide



More information about the Python-list mailing list