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 r.david.murray
Recipients Jonas.Eriksson, r.david.murray
Date 2013-07-24.19:17:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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>
       <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.
Date User Action Args
2013-07-24 19:17:05r.david.murraysetrecipients: + r.david.murray, Jonas.Eriksson
2013-07-24 19:17:05r.david.murraysetmessageid: <>
2013-07-24 19:17:05r.david.murraylinkissue18547 messages
2013-07-24 19:17:04r.david.murraycreate