Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4bd023f

Browse files
committed
* lib3.tex (module string): added rindex().
* lib1.tex (section{Built-in Functions}): added bagof(), lambda(), map() and reduce(). Repharased apply(). Removed or rephrased references to exec() (now the exec stmt). * lib4.tex: posix.exec --> posix.execv * ref4.tex, ref8.tex, tut.tex: builtin --> __builtin__ * lib3.tex (module string): added atof() and atol(), and ato[fl]_error.
1 parent 3b71604 commit 4bd023f

6 files changed

Lines changed: 42 additions & 42 deletions

File tree

Doc/ref/ref4.tex

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ \section{Code blocks, execution frames, and name spaces} \label{execframes}
1919
The following are code blocks: A module is a code block. A function
2020
body is a code block. A class definition is a code block. Each
2121
command typed interactively is a separate code block; a script file is
22-
a code block. The string argument passed to the built-in functions
23-
\verb\eval\ and \verb\exec\ are code blocks. And finally, the
22+
a code block. The string argument passed to the built-in function
23+
\verb\eval\ and to the \verb\exec\ statement are code blocks.
24+
And finally, the
2425
expression read and evaluated by the built-in function \verb\input\ is
2526
a code block.
2627

@@ -66,7 +67,7 @@ \section{Code blocks, execution frames, and name spaces} \label{execframes}
6667

6768
When a global name is not found in the global name space, it is
6869
searched in the list of ``built-in'' names (which is actually the
69-
global name space of the module \verb\builtin\). When a name is not
70+
global name space of the module \verb\__builtin__\). When a name is not
7071
found at all, the \verb\NameError\ exception is raised.
7172

7273
The following table lists the meaning of the local and global name

Doc/ref/ref8.tex

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ \section{Complete Python programs}
1414
Python program. A complete Python program is executed in a minimally
1515
initialized environment: all built-in and standard modules are
1616
available, but none have been initialized, except for \verb\sys\
17-
(various system services), \verb\builtin\ (built-in functions,
17+
(various system services), \verb\__builtin__\ (built-in functions,
1818
exceptions and \verb\None\) and \verb\__main__\. The latter is used
1919
to provide the local and global name space for execution of the
2020
complete program.
2121
\bimodindex{sys}
2222
\bimodindex{__main__}
23-
\bimodindex{builtin}
23+
\bimodindex{__builtin__}
2424

2525
The syntax for a complete Python program is that for file input,
2626
described in the next section.
@@ -58,11 +58,7 @@ \section{File input}
5858

5959
\item when parsing a module;
6060

61-
\item when parsing a string passed to \verb\exec()\;
62-
\bifuncindex{exec}
63-
64-
\item when parsing a file passed to \verb\execfile()\;
65-
\bifuncindex{execfile}
61+
\item when parsing a string passed to the \verb\exec\ statement;
6662

6763
\end{itemize}
6864

Doc/ref4.tex

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ \section{Code blocks, execution frames, and name spaces} \label{execframes}
1919
The following are code blocks: A module is a code block. A function
2020
body is a code block. A class definition is a code block. Each
2121
command typed interactively is a separate code block; a script file is
22-
a code block. The string argument passed to the built-in functions
23-
\verb\eval\ and \verb\exec\ are code blocks. And finally, the
22+
a code block. The string argument passed to the built-in function
23+
\verb\eval\ and to the \verb\exec\ statement are code blocks.
24+
And finally, the
2425
expression read and evaluated by the built-in function \verb\input\ is
2526
a code block.
2627

@@ -66,7 +67,7 @@ \section{Code blocks, execution frames, and name spaces} \label{execframes}
6667

6768
When a global name is not found in the global name space, it is
6869
searched in the list of ``built-in'' names (which is actually the
69-
global name space of the module \verb\builtin\). When a name is not
70+
global name space of the module \verb\__builtin__\). When a name is not
7071
found at all, the \verb\NameError\ exception is raised.
7172

7273
The following table lists the meaning of the local and global name

Doc/ref8.tex

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ \section{Complete Python programs}
1414
Python program. A complete Python program is executed in a minimally
1515
initialized environment: all built-in and standard modules are
1616
available, but none have been initialized, except for \verb\sys\
17-
(various system services), \verb\builtin\ (built-in functions,
17+
(various system services), \verb\__builtin__\ (built-in functions,
1818
exceptions and \verb\None\) and \verb\__main__\. The latter is used
1919
to provide the local and global name space for execution of the
2020
complete program.
2121
\bimodindex{sys}
2222
\bimodindex{__main__}
23-
\bimodindex{builtin}
23+
\bimodindex{__builtin__}
2424

2525
The syntax for a complete Python program is that for file input,
2626
described in the next section.
@@ -58,11 +58,7 @@ \section{File input}
5858

5959
\item when parsing a module;
6060

61-
\item when parsing a string passed to \verb\exec()\;
62-
\bifuncindex{exec}
63-
64-
\item when parsing a file passed to \verb\execfile()\;
65-
\bifuncindex{execfile}
61+
\item when parsing a string passed to the \verb\exec\ statement;
6662

6763
\end{itemize}
6864

Doc/tut.tex

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1605,15 +1605,19 @@ \section{The {\tt dir()} function}
16051605

16061606
{\tt dir()} does not list the names of built-in functions and variables.
16071607
If you want a list of those, they are defined in the standard module
1608-
{\tt builtin}:
1609-
1610-
\bcode\begin{verbatim}
1611-
>>> import builtin
1612-
>>> dir(builtin)
1613-
['EOFError', 'KeyboardInterrupt', 'MemoryError', 'NameError', 'None', 'Runti
1614-
meError', 'SystemError', 'TypeError', 'abs', 'chr', 'dir', 'divmod', 'eval',
1615-
'exec', 'float', 'input', 'int', 'len', 'long', 'max', 'min', 'open', 'ord'
1616-
, 'pow', 'range', 'raw_input', 'reload', 'type']
1608+
{\tt __builtin__}:
1609+
1610+
\bcode\begin{verbatim}
1611+
>>> import __builtin__
1612+
>>> dir(__builtin__)
1613+
['AccessError', 'AttributeError', 'ConflictError', 'EOFError', 'IOError', 'I
1614+
mportError', 'IndexError', 'KeyError', 'KeyboardInterrupt', 'MemoryError', '
1615+
NameError', 'None', 'OverflowError', 'RuntimeError', 'SyntaxError', 'SystemE
1616+
rror', 'SystemExit', 'TypeError', 'ValueError', 'ZeroDivisionError', 'abs',
1617+
'apply', 'chr', 'cmp', 'coerce', 'compile', 'dir', 'divmod', 'eval', 'execfi
1618+
le', 'float', 'getattr', 'hasattr', 'hash', 'hex', 'id', 'input', 'int', 'le
1619+
n', 'long', 'max', 'min', 'oct', 'open', 'ord', 'pow', 'range', 'raw_input',
1620+
'reload', 'repr', 'round', 'setattr', 'str', 'type']
16171621
>>>
16181622
\end{verbatim}\ecode
16191623

@@ -2083,8 +2087,7 @@ \section{Python scopes and name spaces}
20832087
invocation of the interpreter, either read from a script file or
20842088
interactively, are considered part of a module called \verb\__main__\,
20852089
so they have their own global name space. (The built-in names
2086-
actually also live in a module; this is called \verb\builtin\,
2087-
although it should really have been called \verb\__builtin__\.)
2090+
actually also live in a module; this is called \verb\__builtin__\.)
20882091

20892092
The local name space for a function is created when the function is
20902093
called, and deleted when the function returns or raises an exception

Doc/tut/tut.tex

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1605,15 +1605,19 @@ \section{The {\tt dir()} function}
16051605

16061606
{\tt dir()} does not list the names of built-in functions and variables.
16071607
If you want a list of those, they are defined in the standard module
1608-
{\tt builtin}:
1609-
1610-
\bcode\begin{verbatim}
1611-
>>> import builtin
1612-
>>> dir(builtin)
1613-
['EOFError', 'KeyboardInterrupt', 'MemoryError', 'NameError', 'None', 'Runti
1614-
meError', 'SystemError', 'TypeError', 'abs', 'chr', 'dir', 'divmod', 'eval',
1615-
'exec', 'float', 'input', 'int', 'len', 'long', 'max', 'min', 'open', 'ord'
1616-
, 'pow', 'range', 'raw_input', 'reload', 'type']
1608+
{\tt __builtin__}:
1609+
1610+
\bcode\begin{verbatim}
1611+
>>> import __builtin__
1612+
>>> dir(__builtin__)
1613+
['AccessError', 'AttributeError', 'ConflictError', 'EOFError', 'IOError', 'I
1614+
mportError', 'IndexError', 'KeyError', 'KeyboardInterrupt', 'MemoryError', '
1615+
NameError', 'None', 'OverflowError', 'RuntimeError', 'SyntaxError', 'SystemE
1616+
rror', 'SystemExit', 'TypeError', 'ValueError', 'ZeroDivisionError', 'abs',
1617+
'apply', 'chr', 'cmp', 'coerce', 'compile', 'dir', 'divmod', 'eval', 'execfi
1618+
le', 'float', 'getattr', 'hasattr', 'hash', 'hex', 'id', 'input', 'int', 'le
1619+
n', 'long', 'max', 'min', 'oct', 'open', 'ord', 'pow', 'range', 'raw_input',
1620+
'reload', 'repr', 'round', 'setattr', 'str', 'type']
16171621
>>>
16181622
\end{verbatim}\ecode
16191623

@@ -2083,8 +2087,7 @@ \section{Python scopes and name spaces}
20832087
invocation of the interpreter, either read from a script file or
20842088
interactively, are considered part of a module called \verb\__main__\,
20852089
so they have their own global name space. (The built-in names
2086-
actually also live in a module; this is called \verb\builtin\,
2087-
although it should really have been called \verb\__builtin__\.)
2090+
actually also live in a module; this is called \verb\__builtin__\.)
20882091

20892092
The local name space for a function is created when the function is
20902093
called, and deleted when the function returns or raises an exception

0 commit comments

Comments
 (0)