[issue26429] os.path.dirname returns empty string instead of "." when file is in current directory

2016-02-24 Thread Eryk Sun
Eryk Sun added the comment: os.path.dirname is documented as the first element of os.path.split, which in turn is documented to be empty when there's no slash in the path. An empty string is treated as the current directory by os.path.abspath. This is in line with an empty element in the PATH

[issue26429] os.path.dirname returns empty string instead of "." when file is in current directory

2016-02-24 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This is documented behavior and changing this will break existing code (for example see the implementation of glob.glob()). If you need this, a workaround is simple and idiomatic: ``os.path.dirname(path) or os.curdir``. -- nosy: +serhiy.storchaka re

[issue26429] os.path.dirname returns empty string instead of "." when file is in current directory

2016-02-24 Thread Eric V. Smith
Eric V. Smith added the comment: Changing to just 3.6, since that's the only place we could change the behavior. That said, I'd be -1 on making such a change. It would no doubt break some existing code. -- nosy: +eric.smith type: -> enhancement versions: -Python 2.7, Python 3.2, Pyth

[issue26429] os.path.dirname returns empty string instead of "." when file is in current directory

2016-02-24 Thread Chaitanya Mannem
New submission from Chaitanya Mannem: Don't know if this is for windows compatibility or whatever but I think it makes more sense if os.path.dirname would return "." if the file passed in was in the current directory. -- components: Library (Lib) messages: 260821 nosy: Chaitanya Mannem