On Sun, Nov 3, 2019 at 12:33 AM Brendan Barnwell <brenb...@brenbarn.net>
wrote:

> 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.
>
>
We *started* down this path in https://bugs.python.org/issue31961 but had
to revert part of that before 3.7 as the implementation was incomplete
making it inconsistent across platforms.
https://github.com/python/cpython/pull/4329.

Specifically accepting PathLike objects within the args list hasn't been
ruled out for the future but nobody has done the relevant work.  Tracking
it and the api issues to answer in https://bugs.python.org/issue38670.

-gpshead (subprocess owner)
_______________________________________________
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/GF7L4XTU6EOC4UFY7ALWACARFCNC6LMZ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to