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
a982eb1e
Commit
a982eb1e
authored
Jul 22, 2002
by
Andrew M. Kuchling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sort changed modules into alphabetical order; no other changes
parent
3c305d96
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
97 additions
and
93 deletions
+97
-93
Doc/whatsnew/whatsnew23.tex
Doc/whatsnew/whatsnew23.tex
+97
-93
No files found.
Doc/whatsnew/whatsnew23.tex
View file @
a982eb1e
...
...
@@ -688,69 +688,45 @@ SourceForge CVS browser.}
\section
{
New and Improved Modules
}
As usual, Python's standard modules had a number of enhancements and
bug fixes. Here's a partial list; consult the
\file
{
Misc/NEWS
}
file
in the source tree, or the CVS logs, for a more complete list.
bug fixes. Here's a partial list of the most notable changes, sorted
alphabetically by module name. Consult the
\file
{
Misc/NEWS
}
file in the source tree for a more
complete list of changes, or look through the CVS logs for all the
details.
\begin{itemize}
\item
The new
\module
{
textwrap
}
module contains functions for wrapping
strings containing paragraphs of text. The
\function
{
wrap(
\var
{
text
}
,
\var
{
width
}
)
}
function takes a string and returns a list containing
the text split into lines of no more than the chosen width. The
\function
{
fill(
\var
{
text
}
,
\var
{
width
}
)
}
function returns a single
string, reformatted to fit into lines no longer than the chosen width.
(As you can guess,
\function
{
fill()
}
is built on top of
\function
{
wrap()
}
. For example:
\item
The
\module
{
array
}
module now supports arrays of Unicode
characters using the
\samp
{
u
}
format character. Arrays also now
support using the
\code
{
+=
}
assignment operator to add another array's
contents, and the
\code
{
*=
}
assignment operator to repeat an array.
(Contributed by Jason Orendorff.)
\item
The Distutils
\class
{
Extension
}
class now supports
an extra constructor argument named
\samp
{
depends
}
for listing
additional source files that an extension depends on. This lets
Distutils recompile the module if any of the dependency files are
modified. For example, if
\samp
{
sampmodule.c
}
includes the header
file
\file
{
sample.h
}
, you would create the
\class
{
Extension
}
object like
this:
\begin{verbatim}
>>> import textwrap
>>> paragraph = "Not a whit, we defy augury: ... more text ..."
>>> textwrap.wrap(paragraph, 60)
["Not a whit, we defy augury: there's a special providence in",
"the fall of a sparrow. If it be now, 'tis not to come; if it",
...]
>>> print textwrap.fill(paragraph, 35)
Not a whit, we defy augury: there's
a special providence in the fall of
a sparrow. If it be now, 'tis not
to come; if it be not to come, it
will be now; if it be not now, yet
it will come: the readiness is all.
>>>
ext = Extension("samp",
sources=["sampmodule.c"],
depends=["sample.h"])
\end{verbatim}
The module also contains a
\class
{
TextWrapper
}
class that actually
implements the text wrapping strategy. Both the
\class
{
TextWrapper
}
class and the
\function
{
wrap()
}
and
\function
{
fill()
}
functions support a number of additional keyword
arguments for fine-tuning the formatting; consult the module's
documentation for details.
% XXX add a link to the module docs?
(Contributed by Greg Ward.)
\item
Two new functions in the
\module
{
math
}
module,
\function
{
degrees(
\var
{
rads
}
)
}
and
\function
{
radians(
\var
{
degs
}
)
}
,
convert between radians and degrees. Other functions in the
\module
{
math
}
module such as
\function
{
math.sin()
}
and
\function
{
math.cos()
}
have always required
input values measured in radians. (Contributed by Raymond Hettinger.)
\item
Three new functions,
\function
{
getpgid()
}
,
\function
{
killpg()
}
,
and
\function
{
mknod()
}
, were added to the
\module
{
posix
}
module that
underlies the
\module
{
os
}
module. (Contributed by Gustavo Niemeyer
and Geert Jansen.)
\item
The
\module
{
socket
}
module now supports timeouts. You
can call the
\method
{
settimeout(
\var
{
t
}
)
}
method on a socket object to
set a timeout of
\var
{
t
}
seconds. Subsequent socket operations that
take longer than
\var
{
t
}
seconds to complete will abort and raise a
\exception
{
socket.error
}
exception.
Modifying
\file
{
sample.h
}
would then cause the module to be recompiled.
(Contributed by Jeremy Hylton.)
(The original timeout implementation was by Tim O'Malley. Michael
Gilfix integrated it into the Python
\module
{
socket
}
module, after the
patch had undergone a lengthy review. After it was checked in, Guido
van~Rossum rewrote parts of it. This is a good example of the free
software development process.)
\item
Two new binary packagers were added to the Distutils.
\code
{
bdist
_
pkgtool
}
builds
\file
{
.pkg
}
files to use with Solaris
\program
{
pkgtool
}
, and
\code
{
bdist
_
sdux
}
builds
\program
{
swinstall
}
packages for use on HP-UX.
An abstract binary packager class,
\module
{
distutils.command.bdist
_
packager
}
, was added; this may make it
easier to write binary packaging commands. (Contributed by Mark
Alexander.)
\item
The
\module
{
getopt
}
module gained a new function,
\function
{
gnu
_
getopt()
}
, that supports the same arguments as the existing
...
...
@@ -769,38 +745,6 @@ example:
(Contributed by Peter
\AA
{
strand
}
.)
\item
Two new binary packagers were added to the Distutils.
\code
{
bdist
_
pkgtool
}
builds
\file
{
.pkg
}
files to use with Solaris
\program
{
pkgtool
}
, and
\code
{
bdist
_
sdux
}
builds
\program
{
swinstall
}
packages for use on HP-UX.
An abstract binary packager class,
\module
{
distutils.command.bdist
_
packager
}
, was added; this may make it
easier to write binary packaging commands. (Contributed by Mark
Alexander.)
\item
The Distutils
\class
{
Extension
}
class now supports
an extra constructor argument named
\samp
{
depends
}
for listing
additional source files that an extension depends on. This lets
Distutils recompile the module if any of the dependency files are
modified. For example, if
\samp
{
sampmodule.c
}
includes the header
file
\file
{
sample.h
}
, you would create the
\class
{
Extension
}
object like
this:
\begin{verbatim}
ext = Extension("samp",
sources=["sampmodule.c"],
depends=["sample.h"])
\end{verbatim}
Modifying
\file
{
sample.h
}
would then cause the module to be recompiled.
(Contributed by Jeremy Hylton.)
\item
The
\module
{
array
}
module now supports arrays of Unicode
characters using the
\samp
{
u
}
format character. Arrays also now
support using the
\code
{
+=
}
assignment operator to add another array's
contents, and the
\code
{
*=
}
assignment operator to repeat an array.
(Contributed by Jason Orendorff.)
\item
The
\module
{
grp
}
,
\module
{
pwd
}
, and
\module
{
resource
}
modules
now return enhanced tuples:
...
...
@@ -811,6 +755,25 @@ now return enhanced tuples:
('amk', 500)
\end{verbatim}
\item
Two new functions in the
\module
{
math
}
module,
\function
{
degrees(
\var
{
rads
}
)
}
and
\function
{
radians(
\var
{
degs
}
)
}
,
convert between radians and degrees. Other functions in the
\module
{
math
}
module such as
\function
{
math.sin()
}
and
\function
{
math.cos()
}
have always required
input values measured in radians. (Contributed by Raymond Hettinger.)
\item
Three new functions,
\function
{
getpgid()
}
,
\function
{
killpg()
}
,
and
\function
{
mknod()
}
, were added to the
\module
{
posix
}
module that
underlies the
\module
{
os
}
module. (Contributed by Gustavo Niemeyer
and Geert Jansen.)
\item
The parser objects provided by the
\module
{
pyexpat
}
module
can now optionally buffer character data, resulting in fewer calls to
your character data handler and therefore faster performance. Setting
the parser object's
\member
{
buffer
_
text
}
attribute to
\constant
{
True
}
will enable buffering.
\item
The
\module
{
readline
}
module also gained a number of new
functions:
\function
{
get
_
history
_
item()
}
,
\function
{
get
_
current
_
history
_
length()
}
, and
\function
{
redisplay()
}
.
...
...
@@ -821,17 +784,58 @@ to the \module{signal} module by adding the \function{sigpending},
by the platform. These functions make it possible to avoid some previously
unavoidable race conditions.
\item
The
\module
{
socket
}
module now supports timeouts. You
can call the
\method
{
settimeout(
\var
{
t
}
)
}
method on a socket object to
set a timeout of
\var
{
t
}
seconds. Subsequent socket operations that
take longer than
\var
{
t
}
seconds to complete will abort and raise a
\exception
{
socket.error
}
exception.
The original timeout implementation was by Tim O'Malley. Michael
Gilfix integrated it into the Python
\module
{
socket
}
module, after the
patch had undergone a lengthy review. After it was checked in, Guido
van~Rossum rewrote parts of it. This is a good example of the free
software development process in action.
\item
The new
\module
{
textwrap
}
module contains functions for wrapping
strings containing paragraphs of text. The
\function
{
wrap(
\var
{
text
}
,
\var
{
width
}
)
}
function takes a string and returns a list containing
the text split into lines of no more than the chosen width. The
\function
{
fill(
\var
{
text
}
,
\var
{
width
}
)
}
function returns a single
string, reformatted to fit into lines no longer than the chosen width.
(As you can guess,
\function
{
fill()
}
is built on top of
\function
{
wrap()
}
. For example:
\begin{verbatim}
>>> import textwrap
>>> paragraph = "Not a whit, we defy augury: ... more text ..."
>>> textwrap.wrap(paragraph, 60)
["Not a whit, we defy augury: there's a special providence in",
"the fall of a sparrow. If it be now, 'tis not to come; if it",
...]
>>> print textwrap.fill(paragraph, 35)
Not a whit, we defy augury: there's
a special providence in the fall of
a sparrow. If it be now, 'tis not
to come; if it be not to come, it
will be now; if it be not now, yet
it will come: the readiness is all.
>>>
\end{verbatim}
The module also contains a
\class
{
TextWrapper
}
class that actually
implements the text wrapping strategy. Both the
\class
{
TextWrapper
}
class and the
\function
{
wrap()
}
and
\function
{
fill()
}
functions support a number of additional keyword
arguments for fine-tuning the formatting; consult the module's
documentation for details.
% XXX add a link to the module docs?
(Contributed by Greg Ward.)
\item
The DOM implementation
in
\module
{
xml.dom.minidom
}
can now generate XML output in a
particular encoding, by specifying an optional encoding argument to
the
\method
{
toxml()
}
and
\method
{
toprettyxml()
}
methods of DOM nodes.
\item
The parser objects provided by the
\module
{
pyexpat
}
module
can now optionally buffer character data, resulting in fewer calls to
your character data handler and therefore faster performance. Setting
the parser object's
\member
{
buffer
_
text
}
attribute to
\constant
{
True
}
will enable buffering.
\end{itemize}
...
...
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