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

Skip to content

Commit 8940faf

Browse files
committed
Additions from Marc-Andre Lemburg <[email protected]>, documenting
getdefaultencoding() and setdefaultencoding().
1 parent 1491cac commit 8940faf

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

Doc/lib/libsys.tex

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,12 @@ \section{\module{sys} ---
142142
fatal internal error is detected, or when \code{os._exit()} is called.
143143
\end{datadesc}
144144

145+
\begin{funcdesc}{getdefaultencoding}{}
146+
Return the name of the current default string encoding used by the
147+
Unicode implementation.
148+
\versionadded{2.0}
149+
\end{funcdesc}
150+
145151
\begin{funcdesc}{getrefcount}{object}
146152
Return the reference count of the \var{object}. The count returned is
147153
generally one higher than you might expect, because it includes the
@@ -254,7 +260,7 @@ \section{\module{sys} ---
254260
Strings specifying the primary and secondary prompt of the
255261
interpreter. These are only defined if the interpreter is in
256262
interactive mode. Their initial values in this case are
257-
\code{'>>> '} and \code{'... '}. If a non-string object is assigned
263+
\code{'>\code{>}> '} and \code{'... '}. If a non-string object is assigned
258264
to either variable, its \function{str()} is re-evaluated each time
259265
the interpreter prepares to read a new interactive command; this can
260266
be used to implement a dynamic prompt.
@@ -270,6 +276,20 @@ \section{\module{sys} ---
270276
maximizing responsiveness as well as overhead.
271277
\end{funcdesc}
272278

279+
\begin{funcdesc}{setdefaultencoding}{name}
280+
Set the current default string encoding used by the Unicode
281+
implementation. If \var{name} does not match any available
282+
encoding, \exception{LookupError} is raised. This function is only
283+
intended to be used by the \refmodule{site} module implementation
284+
and, where needed, by \module{sitecustomize}. Once used by the
285+
\refmodule{site} module, it is removed from the \module{sys}
286+
module's namespace.
287+
% Note that \refmodule{site} is not imported if
288+
% the \programopt{-S} option is passed to the interpreter, in which
289+
% case this function will remain available.
290+
\versionadded{2.0}
291+
\end{funcdesc}
292+
273293
\begin{funcdesc}{setprofile}{profilefunc}
274294
Set the system's profile function, which allows you to implement a
275295
Python source code profiler in Python. See the chapter on the

0 commit comments

Comments
 (0)