On Sat, Nov 2, 2019 at 9:52 PM MRAB <pyt...@mrabarnett.plus.com> wrote: > > On 2019-11-03 00:38, Chris Angelico wrote: > > On Sun, Nov 3, 2019 at 11:34 AM Eric V. Smith <e...@trueblade.com> wrote: > >> > >> On 11/2/2019 7:24 PM, Steven D'Aprano wrote: > >> > I see no reason why this shouldn't be allowed. It seems like a > >> > straight-forward feature request, and one that is compatible with the > >> > basic idea that Path objects should be usable anywhere you need a file > >> > name. > >> > >> The problem is that in the given example, to turn: > >> `Popen(('/path/to/program', '-o', fspath(outputPath), fspath(inputPath)` > >> Into this: > >> `Popen(('/path/to/program', '-o', outputPath, inputPath` > >> > >> There's no way for Popen to know that outputPath and inputPath are in > >> fact file names. So unless you want to call str() on every element of > >> args (Popen's first parameter), I don't see how you'd implement this. > >> > > > > I wouldn't see a problem with that. It'd mean you can also pass an > > integer as an argument, and it'd be sent as digits. I've wanted that a > > number of times too. > > > It would also let you pass a whole load of other things too. It would > accept x if str(x) returns a string ... which means _anything_. Lists, > dicts, compiled regexes, ....
My response is "don't do that." :-P I think the principle of consenting adults applies. Seems pretty obvious that if you pass random junk to a command not designed to accept it, then anything could happen. Or as they say, "garbage in, garbage out". I really don't think this would be misused, at least not without immediately getting errors, and there's no hidden "gotcha" (at least on the surface) that makes it difficult to realize what's wrong. If the arguments to the command don't make sense, you're almost always going to immediately get errors. So there's no reason in that regard to not allow it, and I'm +1 on the idea. _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/KAXQGIWCN6QZSGORXM542DQXT4IMMIC7/ Code of Conduct: http://python.org/psf/codeofconduct/