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

Greg Ewing greg@cosc.canterbury.ac.nz
Thu, 13 Mar 2003 14:51:27 +1300 (NZDT)


Kevin Altis <altis@semi-retired.com>:

> Pity the functions aren't named
> os.path.head and os.path.tail.

It wouldn't be entirely clear what they mean even then --
"head" might mean just the first pathname component.

In a tool I wrote some years ago in Scheme, I called
them "filename-directory" and "filename-nondirectory".
Which suffered from the same problem, really (they
didn't consult the file system either). But it didn't
matter, since I was the only person who used them,
and *I* knew what they meant. :-)

Maybe they should be called 
"all_except_the_last_pathname_component"
and "last_pathname_component"?

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	   +--------------------------------------+