f | |
| :mod:`user` --- User-specific configuration hook |
| ================================================ |
| |
| .. module:: user |
| :synopsis: A standard way to reference user-specific modules. |
n | :deprecated: |
| |
n | .. deprecated:: 2.6 |
| The :mod:`user` module has been removed in Python 3.0. |
| |
| .. index:: |
| pair: .pythonrc.py; file |
| triple: user; configuration; file |
| |
| As a policy, Python doesn't run user-specified code on startup of Python |
| programs. (Only interactive sessions execute the script specified in the |
| :envvar:`PYTHONSTARTUP` environment variable if it exists). |
| |
| import user |
| |
| verbose = bool(getattr(user, "spam_verbose", 0)) |
| |
| (The three-argument form of :func:`getattr` is used in case the user has not |
| defined ``spam_verbose`` in their :file:`.pythonrc.py` file.) |
| |
t | Programs with extensive customization needs are better off reading a program- |
t | Programs with extensive customization needs are better off reading a |
| specific customization file. |
| program-specific customization file. |
| |
| Programs with security or privacy concerns should *not* import this module; a |
| user can easily break into a program by placing arbitrary code in the |
| :file:`.pythonrc.py` file. |
| |
| Modules for general use should *not* import this module; it may interfere with |
| the operation of the importing program. |
| |