Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
f96e0d20
Commit
f96e0d20
authored
Sep 09, 2000
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Various clarifications and minor nits fixed. Affected descriptions of
input(), locals(), reload(), unicode(), and zip().
parent
1172a851
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
7 deletions
+21
-7
Doc/lib/libfuncs.tex
Doc/lib/libfuncs.tex
+21
-7
No files found.
Doc/lib/libfuncs.tex
View file @
f96e0d20
...
...
@@ -310,6 +310,19 @@ module from which it is called).
\begin{funcdesc}
{
input
}{
\optional
{
prompt
}}
Equivalent to
\code
{
eval(raw
_
input(
\var
{
prompt
}
))
}
.
\strong
{
Warning:
}
This function is not safe from user errors! It
expects a valid Python expression as input; if the input is not
syntactically valid, a
\exception
{
SyntaxError
}
will be raised.
Other exceptions may be raised if there is an error during
evaluation. (On the other hand, sometimes this is exactly what you
need when writing a quick script for expert use.)
If the
\module
{
readline
}
module was loaded, then
\function
{
input()
}
will use it to provide elaborate line editing and
history features.
Consider using the
\function
{
raw
_
input()
}
function for general input
from users.
\end{funcdesc}
\begin{funcdesc}
{
int
}{
x
\optional
{
, radix
}}
...
...
@@ -374,7 +387,7 @@ returns \code{['a', 'b', 'c']} and \code{list( (1, 2, 3) )} returns
\begin{funcdesc}
{
locals
}{}
Return a dictionary representing the current local symbol table.
\strong
{
Warning:
}
t
he contents of this dictionary should not be
\strong
{
Warning:
}
T
he contents of this dictionary should not be
modified; changes may not affect the values of local variables used by
the interpreter.
\end{funcdesc}
...
...
@@ -574,7 +587,7 @@ and skip its initialization if desired.
It is legal though generally not very useful to reload built-in or
dynamically loaded modules, except for
\module
{
sys
}
,
\module
{__
main
__}
and
\module
{__
builtin
__}
. In
certain
cases, however, extension
and
\module
{__
builtin
__}
. In
many
cases, however, extension
modules are not designed to be initialized more than once, and may
fail in arbitrary ways when reloaded.
...
...
@@ -669,11 +682,11 @@ strings. The argument must be in the range [0..65535], inclusive.
\versionadded
{
2.0
}
\end{funcdesc}
\begin{funcdesc}
{
unicode
}{
string
\optional
{
, encoding
='utf-8'
\optional
{
, errors='strict'
}}}
\begin{funcdesc}
{
unicode
}{
string
\optional
{
, encoding
\optional
{
, errors
}}}
Decodes
\var
{
string
}
using the codec for
\var
{
encoding
}
. Error
handling is done according to
\var
{
errors
}
. The default behavior is
to decode UTF-8 in strict mode, meaning that encoding errors raise
\exception
{
ValueError
}
.
\exception
{
ValueError
}
.
See also the
\refmodule
{
codecs
}
module.
\versionadded
{
2.0
}
\end{funcdesc}
...
...
@@ -706,8 +719,9 @@ This function returns a list of tuples, where each tuple contains the
\var
{
i
}
-th element from each of the argument sequences. At least one
sequence is required, otherwise a
\exception
{
TypeError
}
is raised.
The returned list is truncated in length to the length of the shortest
argument sequence. When the argument sequences are all of the same
length,
\function
{
zip()
}
is similar to
\function
{
map()
}
with an
initial argument of
\code
{
None
}
.
argument sequence. When there are multiple argument sequences which
are all of the same length,
\function
{
zip()
}
is similar to
\function
{
map()
}
with an initial argument of
\code
{
None
}
. With a
single sequence argument, it returns a list of 1-tuples.
\versionadded
{
2.0
}
\end{funcdesc}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment