[issue8919] python should read ~/.pythonrc.py by default
report at bugs.python.org
Mon Jun 7 01:18:20 CEST 2010
lesmana <lesmana at gmx.de> added the comment:
the .pythonrc.py file is not deprecated. only the user module is deprecated.
the problem i have with the PYTHONSTARTUP variable is that i find it is an unecessary intermediate step to set up an initialization file.
let me elaborate: every single time you want to use PYTHONSTARTUP in any meaningfull way you will ALSO have to set up the corresponding file somehwere. it makes no sense to set up PYTHONSTARTUP without the file. it also makes no sense to set up the file without PYTHONSTARTUP. so PYTHONSTARTUP needs the file and the file needs PYTHONSTARTUP.
that means the variable PYTHONSTARTUP has no added value. it is just an extra step, an extra source of error and possibly confusion. that is why i suggest to skip the variable and just load the file directly.
if you (or anyone else) can point out a use case which can be done with PYTHONSTARTUP but cannot be done with my suggested method, or a use case where using PYTHONSTARTUP is so much simpler than using my suggested method, then i say mark this as wontfix. i was not able to think of such a use case, but i might be missing something.
there is the argument that PYTHONSTARTUP allows the flexibility to point to files with other names. that can be easily achieved by setting up an alias in .bashrc (or respective initialization file for your favorite shell) like this: alias python="python --rcfile somefile". alternatively you can symlink .pythonrc.py to somefile.
the effort to set up such an alias or symlink is the same as setting up an environment variable. everyone else who is happy with the default name (the majority in my opinion) will have one step less to set up.
about the name .pythonrc.py: looking around the web i have the impression that many people set their PYTHONSTARTUP variable to point to .pythonrc.py. i think this is because they used to have the .pythonrc.py file loaded by the module user. after they saw that the module user is beeing deprecated they just point PYTHONSTARTUP to that file. other than that i find the name .pythonrc.py is a fitting name for an initialization file.
about the other tools you mentioned. i checked some of them and some other tools which use environment variables. they almost never use the variables to just dully point to a file, exceptions are variables which point to a resource shared with many other tools (the temp directory for example).
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list