PEP idea: On Windows, subprocess should implicitly support .bat and .cmd scripts by using FindExecutable from win32 API

Chris Angelico rosuav at gmail.com
Thu May 7 08:53:16 EDT 2015


On Thu, May 7, 2015 at 10:41 PM, Marko Rauhamaa <marko at pacujo.net> wrote:
> Chris Angelico <rosuav at gmail.com>:
>
>> I was specifically disagreeing with the notion that it's right and
>> normal to write a bunch of platform-specific code in Python. That
>> should be the rarity.
>
> Why is that?
>
> Code is written for a specific need and environment. Often trying to
> write generic solutions leads to cumbersome and clunky results on *all*
> platforms.
>
> A software system is defined through its interfaces.

And the most important interface is with a human. Humans are the same
whether you're running under Windows, Linux, or anything else. If you
want to write single-platform code, go for it; but if you want to
write cross-platform code, the best way is to let someone else take
care of the differences, abstracting them away into a nice tidy thing
that we call a high-level language.

I don't need forking, file descriptors, or process IDs, to describe
how a person uses my code. Those are *implementation details*. Now, it
might be that I have to concern myself with some of them. Maybe I want
to get optimal performance out of something, and that means using
multiple processes and managing them properly. Maybe I need to
interface with systemd, respond to dozens of different process-level
signals, use directory notifications, and do a bunch of other
Linux-only things, so maybe it's just completely impractical to
consider supporting even BSD-based Unixes, much less Windows. So be
it. But to the greatest extent possible, Python should let me write
code that doesn't care about any of that.

ChrisA



More information about the Python-list mailing list