[Python-Dev] Re: os.path.commonprefix breakage (original) (raw)
Greg Ewing greg@cosc.canterbury.ac.nz
Fri, 18 Aug 2000 14:57:34 +1200 (NZST)
- Previous message: [Python-Dev] Re: os.path.commonprefix breakage
- Next message: [Python-Dev] Re: os.path.commonprefix breakage
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
M.-A. Lemburg:
By dropping the trailing slash from the path you are removing important information from the path information.
No, you're not. A trailing slash on a Unix pathname doesn't tell you anything about whether it refers to a directory. Actually, it doesn't tell you anything at all. Slashes simply delimit pathname components, nothing more.
A demonstration of this:
s454% cat > foo/ asdf s454% cat foo/ asdf s454%
A few utilites display pathnames with trailing slashes in order to indicate that they refer to directories, but that's a special convention confined to those tools. It doesn't apply in general.
The only sure way to find out whether a given pathname refers to a directory or not is to ask the filesystem. And if the object referred to doesn't exist, the question of whether it's a directory is meaningless.
Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg@cosc.canterbury.ac.nz +--------------------------------------+
- Previous message: [Python-Dev] Re: os.path.commonprefix breakage
- Next message: [Python-Dev] Re: os.path.commonprefix breakage
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]