[Python-Dev] os.path.dirname misleading?

Guido van Rossum guido@python.org
Wed, 12 Mar 2003 12:04:38 -0500


> I'm not sure whether to classify this as a bug or a feature request.
> Recently, I got burned by the fact that despite the name, dirname()
> does not return the expected directory portion of a path if you pass
> it a directory, instead it will return the parent directory because
> it uses split.

This is the first time I've ever heard of this confusion.  dirname is
named after the Unix shell function of the same name, which behaves
the same way.

I'm not even sure I understand what you expected -- you expected
dirname("foo") to return "foo" if foo is a directory?  What would be
the point of that?

--Guido van Rossum (home page: http://www.python.org/~guido/)