On 2019-11-03 00:02, Eric V. Smith wrote:
On 11/2/2019 10:02 PM, Jonathan Goble wrote:
So there's no reason in that regard to not allow it, and I'm +1 on the idea.

I disagree. I don't think there's precedent in Python for stringifying
parameters. By your logic, shouldn't we also call str() on the
parameters for str.join()? Or how about ord()? (Oops, I accidentally
called len: "s='3'; ord(len(n))".) Or the first parameter of open()? (Do
we really want "open(fn_that_might_occasionally_return_none(), 'w')" to
succeed?)

For the record, I have always thought that str.join should call str on all its arguments. The fact that it doesn't is really annoying.

But to the larger point that Popen "can't know" that the path objects represent filenames. . . why not? Why can't Popen have code that checks if something in the arglist is a Path object, and if so, converts it to a string? That wouldn't be any different than various existing functions that accept, say, something or a tuple of them (e.g., isintance) or alternative formats (e.g., functions in the re module that take either a pattern object or a string). Popen is in the stdlib and is changeable if we want to change it, and I don't see what's so strange about updating it to handle new developments like Path objects.


--
Brendan Barnwell
"Do not follow where the path may lead. Go, instead, where there is no path, and leave a trail."
   --author unknown
_______________________________________________
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/JFS3TFDC4NP32IO2EWM2YPRHQ32G4DQM/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to