Import 'filename'? (was Re: Cross-reference 'import' in a classhierarchy)

Marcus Alanen marcus at infa.abo.fi
Thu Apr 10 09:28:59 EDT 2003


On Thu, 10 Apr 2003 14:30:02 +1200, Greg Ewing (using news.cis.dfn.de)
<ckea25d02 at sneakemail.com> wrote:
>In my opinion, it would be good enough to expand any
>symbolic links (or aliases/shortcuts/whatever your platform
>calls them) and check whether the pathnames are the same.
>
>That won't always work (in the presence of mountings from
>file servers, e.g.) but it can't be any worse than the
>problems we already have with different names for the
>same file.

I'm not sure what your "good enough" algorithm actually does.
Consider also the fact that e.g. on Linux you can mount the same
filesystem several times, in several places. There is no _one unique_
canonical name for a file.

Personally I'd just like a simple stat() for each (non-symlink) file
and remembering their st_dev and st_ino values. I don't know how this
would be emulated on other operating systems, though.

-- 
Marcus Alanen
maalanen at abo.fi




More information about the Python-list mailing list