Mike Orr wrote: > Perhaps this > disrecommendation should be lifted, especially since both Mac and > Windows do the right thing with "/", "..", and "." now.
Is anyone still supporting VMS? It has a wildly different pathname syntax. In any case, if we all start writing code that makes assumptions about pathname syntax, and some platform comes along in the future that does things differently, we're hosed. Do we want to take that risk? > The other thing is, ".." and "." seem to be smarter than > os.path.dirname. You can certainly get different results if you interpret a path containing . or .. through the file system than if you treat it as a pure pathname manipulation. But the same will be true of any OO replacement that also restricts itself to pathname manipulation -- it won't be able to treat . and .. any more smartly than os.path does. > '.' off a file chops the filename component, Not sure what you mean by that. On Unix, if you try to open "foo.c/." where "foo.c" is not a directory, you get an exception: >>> open("foo.c/.") Traceback (most recent call last): File "<stdin>", line 1, in ? IOError: [Errno 20] Not a directory: 'foo.c/.' But os.path has no idea what foo.c is, so it just treats joining "." to a path and then normalising as a no-op. > '..' off a file goes to the file's directory, while '..' off > a directory goes to the directory's parent. These aren't different things -- in both cases you're getting the directory that contains the object in question. > I think a method like .ancestor(N) would be useful, > meaning "do '..' N times. That would be handy, yes. -- Greg _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com