R. David Murray added the comment:
Oh, it would definitely be a backward compatibility issue. Imagine code that
does a dirname and branches like this:
d = dirname(somepath)
if d:
<handle directory>
else:
<no directory case>
Or to give a more concrete example:
path = fn if dirname(fn) else os.path.join(defaultdir, fn)
As you can see, the current behavior has significant value in Python. So I
think it is behaving correctly. Python is not the shell, even though it does
have many functions that provide APIs very similar to the corresponding shell
functions.
See issue 17545 for a related issue, and specifically msg189401 for another
reason why the current behavior of dirname is correct within the logic of
Python.
Based on the above I'm going to go ahead and close this. If other developers
disagree they can reopen. If they don't, and you disagree, I would suggest
that talking about it on python-ideas would be your next step.
----------
nosy: +r.david.murray
resolution: -> rejected
stage: -> committed/rejected
status: open -> closed
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue18547>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com