Raymond Hettinger <rhettin...@users.sourceforge.net> added the comment:
> My point was that unix hasn't found it useful > to add a level option to the dirname API. ISTM, that is a strong indication that this isn't needed in the form it has been proposed. > I don't know that I personally have ever had > occasion to peel off more than one directory level > without also wanting to do something with the > intermediate results, so perhaps I am not a good > judge of how useful this would be. I think this only arises when a known directory structure has been attached at some arbitrary point on a tree, so you might use a relative path like ../../bin/command.py in the shell. To serve that use case, it would be better to have a function that splits all the components of the path into a list that's easily manipulated: >>> oldpath = os.path.splitpath('/ggparent/gparent/parent/') >>> newpath = oldpath[:-2] + ['bin', 'command.py'] >>> os.path.join(*newpath) '/ggparent/bin/command.py' ---------- nosy: +rhettinger _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue11344> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com