diff -r be3b41703822 Doc/library/linecache.rst --- a/Doc/library/linecache.rst Tue Mar 10 16:32:50 2015 +0100 +++ b/Doc/library/linecache.rst Tue Mar 10 10:44:11 2015 -0700 @@ -9,7 +9,8 @@ -------------- -The :mod:`linecache` module allows one to get any line from any file, while +The :mod:`linecache` module allows one to get a line from a Python source file, +or another UTF-8 text file, while 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 to retrieve source lines for inclusion in the formatted traceback. @@ -58,3 +59,8 @@ >>> linecache.getline('/etc/passwd', 4) 'sys:x:3:3:sys:/dev:/bin/sh\n' +.. note:: + + This module looks for an :ref:`encoding comment ` in + the first two lines of the file to determine what text encoding to use. + If this isn't present, the file must be readable as UTF-8.