File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
Misc/NEWS.d/next/Documentation Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,19 @@ directory rather than a file. No item is added to ``sys.path`` more than
6161once. Blank lines and lines beginning with ``# `` are skipped. Lines starting
6262with ``import `` (followed by space or tab) are executed.
6363
64+ .. note ::
65+
66+ An executable line in a :file: `.pth ` file is run at every Python startup,
67+ regardless of whether a particular module is actually going to be used.
68+ Its impact should thus be kept to a minimum.
69+ The primary intended purpose of executable lines is to make the
70+ corresponding module(s) importable
71+ (load 3rd-party import hooks, adjust :envvar: `PATH ` etc).
72+ Any other initialization is supposed to be done upon a module's
73+ actual import, if and when it happens.
74+ Limiting a code chunk to a single line is a deliberate measure
75+ to discourage putting anything more complex here.
76+
6477.. index ::
6578 single: package
6679 triple: path; configuration; file
Original file line number Diff line number Diff line change 1+ Added a note about the intended use of code in .pth files.
You can’t perform that action at this time.
0 commit comments