[Python-ideas] Possible Enhancement to py Launcher - set default

Franklin? Lee leewangzhong+python at gmail.com
Mon Feb 5 20:17:53 EST 2018


On Mon, Feb 5, 2018 at 6:04 AM, Paul Moore <p.f.moore at gmail.com> wrote:
> On 5 February 2018 at 08:10, Steve Barnes <gadgetsteve at live.co.uk> wrote:
>> When a new version of python is in alpha/beta it is often desirable to
>> have it installed for tests but remain on a previous version for day to
>> day use.
>>
>> However, currently the Windows py launcher defaults to the highest
>> version that it finds, which means that unless you are very careful you
>> will end up having to explicitly specify your older version every time
>> that you start python with it once you have installed the newer version.
>>
>> I an thinking that it would be relatively simple to expand the current
>> launcher functionality to allow the user to set the default version to
>> be used.
>>
>> One possible syntax, echoing the way that versions are displayed with
>> the -0 option would be to allow py -n.m* to set and store, either in the
>> registry, environment variable or a configuration file, the desired
>> default to be invoked by py or pyw.
>>
>> Personally I thing that this would encourage more people to undertake
>> testing of new candidate releases of python.
>>
>> I would be interested in any feedback on the value that this might add.
>
> There's a `py.ini` file that lets you set the default version. See
> https://docs.python.org/3.6/using/windows.html#customization for
> details. Is that just something you weren't aware of, or does it not
> address the issue you're having?

I think the feature is still worth considering. Playing with .ini
files should be considered a hack, while a way to change the default
may be useful for many, at all skill levels.

In your link, though, the recommended way to change the default is to
use the environment variable %PY_PYTHON%, rather than the .ini file.
But environment variables are not as key to Windows use as it is to
Linux use, so the feature is still worth considering.

Does the installer offer to change the default to its version, even
when running it after installation?

If it does, it still might be good to add an option to py.exe, because
it's closest to where you'd think to want to change the setting.


More information about the Python-ideas mailing list