Issue #11726: clarify linecache doc: linecache is written to cache Python
source files, even if "it works" with other text files encoded to UTF-8.
This commit is contained in:
parent
6a318d420a
commit
93f0665fb6
|
@ -9,11 +9,15 @@
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
The :mod:`linecache` module allows one to get any line from any file, while
|
The :mod:`linecache` module allows one to get any line from a Python source file, while
|
||||||
attempting to optimize internally, using a cache, the common case where many
|
attempting to optimize internally, using a cache, the common case where many
|
||||||
lines are read from a single file. This is used by the :mod:`traceback` module
|
lines are read from a single file. This is used by the :mod:`traceback` module
|
||||||
to retrieve source lines for inclusion in the formatted traceback.
|
to retrieve source lines for inclusion in the formatted traceback.
|
||||||
|
|
||||||
|
The :func:`tokenize.open` function is used to open Python source files. This
|
||||||
|
function uses :func:`tokenize.detect_encoding` to get the encoding of the
|
||||||
|
Python source file.
|
||||||
|
|
||||||
The :mod:`linecache` module defines the following functions:
|
The :mod:`linecache` module defines the following functions:
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,4 +53,3 @@ Example::
|
||||||
>>> import linecache
|
>>> import linecache
|
||||||
>>> linecache.getline('/etc/passwd', 4)
|
>>> linecache.getline('/etc/passwd', 4)
|
||||||
'sys:x:3:3:sys:/dev:/bin/sh\n'
|
'sys:x:3:3:sys:/dev:/bin/sh\n'
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue