[issue11344] Add height argument to os.path.dirname()

Terry J. Reedy report at bugs.python.org
Fri Mar 4 22:49:08 CET 2011

Terry J. Reedy <tjreedy at udel.edu> added the comment:

I am inclined to -1 also.

a. The proposed behavior is anti-obvious to me: the higher the height, the shorter the result. Calling param 'drop' would be better.

b. Not every one-liner should be wrapped.

>>> path.rsplit('/',0)[0]
>>> path.rsplit('/',1)[0]
>>> path.rsplit('/',2)[0]
>>> path.rsplit('/',3)[0]

Note: above gives '' for maxsplit out of range, easily converted to exception in function wrapper.

nosy: +terry.reedy

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list