Steinmann <[email protected]> added the comment:
@Brett: I also think making Path('.').name evaluate to '.' would be the most
logical thing. More even so since the documentation says PurePath.name() is
equivalent to os.path.basename()[1], but:
>>> Path('.').name
''
>>> os.path.basename('.')
'.'
Though I'm not sure if that is ok to change this behaviour or if people already
rely on it.
No matter which decision is made, I would say the documentation should be
improved.
If it will be the same as basename, document this also here [2].
Otherwise add a note to [1], maybe in the same format and position as was done
for os.path.relpath().
[1]
https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module
[2] https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.name
----------
nosy: +lucas.steinmann
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue37130>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com