The os.path conventions do follow, '' and '.' are not treated the same here either --
>>> os.path.exists('')
False
>>> os.path.exists('.')
True
>>> os.path.isdir('')
False
>>> os.path.isdir('.')
True
The only os.path function that I see as potentially confusing in this discussion is dirname, as that can return an empty string which yields unexpected results when used as an argument for other functions.
>>> os.path.dirname('testdir')
''
>>> os.path.dirname('./testdir')
'.'
However, changing this functionality (e.g. os.path.dirname('testdir') returning '.') would result in backward-compatibility issues that would not be warranted (IMO).
I'll leave the final word to Serhiy to close out as 'not a bug' at his discretion. |