On Wed, 10 Feb 2021 at 11:01, Inada Naoki <[email protected]> wrote: > > On Wed, Feb 10, 2021 at 5:33 PM Paul Moore <[email protected]> wrote: > > > > So get PYTHONUTF8 added to the environment activate script. That's a > > simple change to venv. And virtualenv, and conda - yes, it need to > > happen in multiple places, but that's still easier IMO than proposing > > a change to Python's already complex (and slower than many of us would > > like) startup process. > > I am not sure this idea works fine. Is the activate script always > called when venv is used on Windows? > > When I use venv on Unix, I often just execute .venv/bin/some-script > without activating the venv.
So in your training course, tell users to activate the environment. Experienced users (like you) who can run scripts directly aren't the target of this change, are they? This is one of the frustrating points here, I'm not clear who the target is. When I say it wouldn't help me, I'm told I'm not the target. When I suggest an alternative, it apparently isn't useful because it wouldn't work for you... > Students may need to learn about encoding at some point. > But when they learn "how to read/write file" first time, they don't > need to know what encoding is. Agreed. > VSCode, notepad, PyCharm use UTF-8 by default. > Students don't need to learn how to use encoding other than UTF-8 > until really need it. If they only use ASCII files and a system codepage that is the same as ASCII for the first 127 characters, they it's irrelevant. If they read data from a legacy system, that is quite likely to be in the system codepage (most of the local files I use at work, for example, are not UTF-8). So I'd say that many students don't need to learn how to use *any* encoding until they need it. But I'm not a professional trainer, so my experience is limited. > We can add "Enable the UTF-8 mode" checkbox to the installer. > And we can have "Enable the UTF-8 mode" tool in the start menu. > So students don't need to edit the ini file manually. Those options could set the environment variable. After all, that's what "Add Python to PATH" does, and people seem OK with that. No need for an ini file (that adds an extra file read to the startup time, as has already been mentioned as a downside). > The problem is; should we recommend to enable UTF-8 mode globally by > setting environment variable, or provide a per-site UTF-8 mode > setting? What precisely do you mean by "per site"? Do you mean "per Python interpreter"? Do you view separate virtual environments as "sites"? Again, I don't understand who the target audience is here. > > >> > I don't want to recommend env vars and registry for conda and portable > > >> > Python users... > > > > > > and a lot of newbies learning Python for data science are starting out > > > with conda as well ... > > > > So conda could set UTF-8 mode with "conda env --new --utf8". No > > changes to core Python interpreter startup needed. > > > > They may not want to promote UTF-8 mode until official Python promote > UTF-8 mode. > So I think venv should support UTF-8 mode first. That's fair enough. Although I'd like to point out the parallel here - you're saying "environment tools might not want to make UTF8 the default until Python does". I'm saying "Python might not want to make UTF8 the default until the OS does". I'm not completely sure why your argument is stronger than mine :-) > Because it solves many real world problem that many Windows users suffer. OK. My experience differs, but that's fine. But why wasn't this a consideration when UTF8 mode was first designed? At that point, an interpreter flag and an environment variable were considered sufficient. Why is that no longer true? Is it because the initial design of UTF8 mode ignored Windows? Why, if this is such a Windows-specific problem? Sigh. To be honest, I don't have the time (or the interest) to go back over all the history here. I think I'm just going to have to drop this discussion and wait to comment when a concrete proposal is put forward. PEP 597 is the only actual PEP on the table at the moment, everything else is just speculation, and I really can't keep up with the volume of discussion in the various threads. Paul _______________________________________________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/2GNE2IOHDN2XPTBLEDPMTLRVTUK56IFV/ Code of Conduct: http://python.org/psf/codeofconduct/
