[Python-Dev] Python install layout and the PATH on win32

Paul Moore p.f.moore at gmail.com
Sat Mar 17 15:50:24 CET 2012


On 17 March 2012 14:07, Serhiy Storchaka <storchaka at gmail.com> wrote:
> 17.03.12 13:57, Paul Moore написав(ла):
>
>> As there is no
>> way of knowing the Python version without running Python, this is too
>> slow to be practical.
>
>
> Cold start:
> $ time python3 --version
> Python 3.1.2
>
> real    0m0.073s
> user    0m0.004s
> sys     0m0.004s
>
> Hot start:
> $ time python3 --version
> Python 3.1.2
>
> real    0m0.007s
> user    0m0.004s
> sys     0m0.004s

Blame it on Windows or my overloaded PC if you must :-) but I get
perceptible delays on a cold start at times. Plus, I'd probably need
to do this in code that enumerates all installed Pythons and
virtualenvs - that could be 10 installations. I've never tried it in
anger, so I could be worrying over nothing, but to an extent that's my
point - I don't *need* to know the version unless I have to have
version-specific code to define the layout.

And if I were starting Python up, I'd probably be better just
importing sys and sysconfig, and using sys.executable and
sysconfig.get_path('scripts'). And there's the chicken-and-egg problem
- if I don't know the version, I don't know where python.exe is, so
how can I run it to find the version?

Meh. None of this is a real issue. It's just some extra messy coding.
But Van's point is that this proposal gives him less hard coding.
Beyond pointing out that it gives me more, I don't have much to add.

Paul.


More information about the Python-Dev mailing list