File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -610,15 +610,16 @@ the module.
610
610
import system may opt to leave it unset if it has no semantic
611
611
meaning (e.g. a module loaded from a database).
612
612
613
- If ``__file__ `` is set, it may also be appropriate to set the
614
- `` __cached__ `` attribute which is the path to any compiled version of
613
+ If ``__file__ `` is set then the `` __cached__ `` attribute might also
614
+ be set, which is the path to any compiled version of
615
615
the code (e.g. byte-compiled file). The file does not need to exist
616
616
to set this attribute; the path can simply point to where the
617
617
compiled file would exist (see :pep: `3147 `).
618
618
619
- It is also appropriate to set ``__cached__ `` when ``__file__ `` is not
619
+ Note that ``__cached__ `` may be set even if ``__file__ `` is not
620
620
set. However, that scenario is quite atypical. Ultimately, the
621
- loader is what makes use of ``__file__ `` and/or ``__cached__ ``. So
621
+ loader is what makes use of the module spec provided by the finder
622
+ (from which ``__file__ `` and ``__cached__ `` are derived). So
622
623
if a loader can load from a cached module but otherwise does not load
623
624
from a file, that atypical scenario may be appropriate.
624
625
You can’t perform that action at this time.
0 commit comments