This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author paul.moore
Recipients docs@python, eryksun, gaborjbernat, keller00, paul.moore, steve.dower, tim.golden, vinay.sajip, zach.ware
Date 2020-10-18.19:50:24
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1603050624.51.0.00682163712096.issue42041@roundup.psfhosted.org>
In-reply-to
Content
Well, I'm not convinced that using `shutil.which` is the right answer for anything other than "python". And even there, I'd recommend using `sys.executable` over `shutil.which` in pretty much every case.

My view is that if we ignore the "weirdness" introduced by the redirector[1], for everything else `subprocess` is fine - it searches for the executable using the normal platform semantics. That's nearly always the same across platforms, and when it isn't, users may well prefer consistency with the platform over identical cross-platform behaviour. And if they *do* want cross-platform consistency, at the cost of occasional differences between their program's behaviour and (for example) the shell, then they have `shutil.which` available.

Saying that `subprocess` follows platform semantics is easy, and clear. People who need to know platform details can find them out. People who want Python-defined cross-platform semantics have `shutil.which`.

That's the basis on which I feel that documenting the Windows rules is unnecessary. Also, why would we document the Windows rules, but not the POSIX rules? They are arguably just as strange to someone who doesn't know them.

[1] I would characterise that weirdness as being that the redirector impacts the behaviour of how the platform locates the "python" command under the platform search rules of the platform the redirector is used on - even though we don't document the behaviour of the redirector so the user cannot infer the actual rules without knowing implementation details.
History
Date User Action Args
2020-10-18 19:50:24paul.mooresetrecipients: + paul.moore, vinay.sajip, tim.golden, docs@python, zach.ware, eryksun, steve.dower, gaborjbernat, keller00
2020-10-18 19:50:24paul.mooresetmessageid: <1603050624.51.0.00682163712096.issue42041@roundup.psfhosted.org>
2020-10-18 19:50:24paul.moorelinkissue42041 messages
2020-10-18 19:50:24paul.moorecreate