[Tutor] why does platform.architecture default to sys.executable?

Amit Saha amitsaha.in at gmail.com
Sat Oct 26 18:51:17 CEST 2013


On Sun, Oct 27, 2013 at 2:39 AM, Albert-Jan Roskam <fomcl at yahoo.com> wrote:
> Hi,
>
> Why does the "executable" parameter default to sys.executable? Yesterday I
> was surprised to see platform.architecture return "32bit" on a 64-bit
> system, just because a 32-bit Python interpreter was installed. Wouldn't
> this make more sense:
>
> import sys, platform
> pf = sys.platform.lower()[:3]
> executable = "iexplore.exe" if pf[:3] == "win" else "/bin/ls"

I think it's mainly because of avoiding choosing arbitrary programs,
although they are most certainly guaranteed to be present. Besides,
there are better ways to find the platform architecture, I think.
os.uname() comes to mind.

-Amit.


More information about the Tutor mailing list