[issue37130] pathlib.Path.with_name() handles '.' and '..' inconsistently

Brett Cannon report at bugs.python.org
Fri Jul 5 17:34:39 EDT 2019


Brett Cannon <brett at python.org> added the comment:

Thinking about this a bit, I my gut says having Path('.').name == '.' makes more sense than returning ''. My reasoning is that in any case where there's a single value -- e.g. Path('spam') -- you end up with the part returned in `name`. That suggests to me that '.' isn't any more special or ambiguous than 'spam' or '..'.

Antoine, what do you think?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37130>
_______________________________________


More information about the Python-bugs-list mailing list