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

Pieter Nagel pieter at nagel.co.za
Mon May 6 15:04:59 CEST 2013


On Mon, 2013-05-06 at 07:38 -0400, Random832 wrote:
> On 05/06/2013 04:30 AM, Pieter Nagel wrote:
> > is_symbolic_link()
> >      This shall return ``os.stat(f).is_symbolic_link()``, or ``False`` if
> >      ``f`` does not exist.
> 
> lstat, surely.

Interesting point.

If is_symbolic_link() is added to stat_result, then what file it
pertains to depends purely on whether one called os.stat() or os.lstat()
to start with. Once the stat_result it returned, the inode is referred
to is fixed.

Currently, all existing isxxx() functions on os.path are implemented in
terms of os.stat(), they follow symlinks. That is why I reflexively
specified the new is_symbolic_link() the same.

But I agree basing it on os.lstat() will be more meaningful.

But will the fact that some isxxx() functions in os.path are based on
os.stat(), and others on os.lstat(), be a sign of a fundamental smell?
Does this argue against mirroring all of the functionality on
stat_result to os.path?


> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
> 

-- 
Pieter Nagel





More information about the Python-ideas mailing list