Eric V. Smith added the comment:
I was using str.join() as an analogy. I apologize if that was confusing.
I'll state this as clearly as I can: I don't think shlex.join() should
automatically convert any arguments to str, not even those that are Path's.
Nothing is going to be solved by having
Richard added the comment:
IMO comparing shlex.join() to str.join() is a mistake. Comparing it to
subprocess.run() is more appropriate.
What do you mean by "proposal"? subprocess.run() already converts Path
arguments to str since Python 3.6 (though IIRC this was broken on Windows until
3.7
Eric V. Smith added the comment:
My point is that shlex.join() shouldn’t convert any arguments to strings, no
matter their type. Just like str.join() doesn’t, and for the same reason.
Within the last few years there was a discussion on making str.join()
auto-convert it’s arguments to str, an
Richard added the comment:
While it may be primarily intended to combine output from shlex.split() again,
IMO it's useful for manually constructed command lines as well, for example
displaying instructions to a user where a path may contain spaces and special
characters and needs to be prope
Eric V. Smith added the comment:
I disagree. In my mind, there's no more reason for shlex.join() to take Path
objects than there is for str.join() to take them, or for shlex.join() to
convert int's to str's. I'd rather shlex.join() continue to raise an exception
if passed something that's no
New submission from Richard :
When one of the items in the iterable passed to shlex.join() is a pathlib.Path
object, it throws an exception saying it must be str or bytes. I believe it
should accept Path objects just like other parts of the standard library such
as subprocess.run() already do