This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients blokeley, pitrou, r.david.murray, rhettinger, terry.reedy
Date 2011-03-05.07:58:59
SpamBayes Score 2.6462658e-08
Marked as misclassified No
Message-id <1299311940.58.0.227485972704.issue11344@psf.upfronthosting.co.za>
In-reply-to
Content
> 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'
History
Date User Action Args
2011-03-05 07:59:00rhettingersetrecipients: + rhettinger, terry.reedy, pitrou, r.david.murray, blokeley
2011-03-05 07:59:00rhettingersetmessageid: <1299311940.58.0.227485972704.issue11344@psf.upfronthosting.co.za>
2011-03-05 07:58:59rhettingerlinkissue11344 messages
2011-03-05 07:58:59rhettingercreate