[Python-ideas] PEP: Extended stat_result (First Draft)

random832 at fastmail.us random832 at fastmail.us
Mon May 6 21:32:40 CEST 2013


> On Mon, 2013-05-06 at 20:28 +0200, Giampaolo Rodola' wrote:
> > -1 about these too.
> > os.path provides only isfile(), isdir() and islink() because those are
> > the most common and portable file types, and that's fine.
> > Anything else is too specific (also *platform* specific) and does not
> > deserve a new utility function in os.path.

I think the question of whether platform-specific functions belong in
the os module can be answered by counting the number of occurrences of
"Availability:" in its documentation. That ship has long sailed, for
good or ill.

On Mon, May 6, 2013, at 14:58, Pieter Nagel wrote:
> The extent to which my additions to stat_result are "mirrored back" to
> os.path is one of the least certain parts of my proposal.

I'm not sure I like these functions either - of the existing ones, only
ntpath.isdir does anything more efficient than just calling stat and
examining the mode - and all of the new ones would be the same. Also,
they silently fail (i.e. return False) rather than let exceptions be
raised from stat (this is an inconsistency between them and the supposed
philosophy people have claimed on this thread, of all file functions
raising exceptions when the file doesn't exist, incidentally)



More information about the Python-ideas mailing list