On Mon, 03 May 2010 06:18:55 -0700, Chris Rebert wrote:

>> but how can python determine the
>> parent directory of a directory that no longer exists?
> 
> Whether or not /home/baz/tmp/xxx/ exists, we know from the very structure
> and properties of directory paths that its parent directory is, *by
> definition*, /home/baz/tmp/ (just chop off everything after the
> second-to-last slash).

Not necessarily.

There are two common interpretations for the concept of a "parent
directory". One is the directory referenced by removing the last component
from the (normalised) path, the other is the directory referenced by
appending ".." to the path.

The two don't necessarily refer to the same directory if the last
component is a symlink (or an additional hard link, on platforms which
allow creating additional hard links to directories).

For the current directory[1], or a directory referenced by a descriptor
rather than a path, the latter definition has to be used, as there is no
path to manipulate.

[1] And also for e.g. "./../..".

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to