[Python-Dev] pathlib handling of trailing slash (Issue #21039)
Ben Finney
ben+python at benfinney.id.au
Thu Aug 7 04:12:30 CEST 2014
Antoine Pitrou <antoine at python.org> writes:
> Le 06/08/2014 20:50, Alexander Belopolsky a écrit :
> > There are many interfaces where trailing slash is significant. […]
> > Loosing it when passing path strings through pathlib.Path() may be a
> > source of bugs.
>
> pathlib is generally concerned with filesystem operations written in
> Python, not arbitrary third-party tools.
The operating system shell is more than an “arbitrary third-party tool”,
though; it preserves paths, and handles invoking commands.
You seem to be saying that ‘pathlib’ is not intended to be helpful for
constructing a shell command. Will its documentation warn that is so?
> Also it is probably easy to append the trailing slash in your
> command-line invocation, if so desired.
The trouble is that one can desire it, and construct a path knowing that
the presence or absence of a trailing slash has semantic significance;
and then have it unaccountably altered by the pathlib.Path code. This is
worse than preserving the semantic value.
--
\ “But Marge, what if we chose the wrong religion? Each week we |
`\ just make God madder and madder.” —Homer, _The Simpsons_ |
_o__) |
Ben Finney
More information about the Python-Dev
mailing list