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

Skip to content

Commit 3ad4e74

Browse files
committed
Wrote text for features added between 2.0b1 and b2.
Minor rewrites, and added the CVS ID in a comment.
1 parent 118ee96 commit 3ad4e74

1 file changed

Lines changed: 35 additions & 8 deletions

File tree

Doc/whatsnew/whatsnew20.tex

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
\documentclass{howto}
22

3+
% $Id$
4+
35
\title{What's New in Python 2.0}
46
\release{0.05}
57
\author{A.M. Kuchling and Moshe Zadka}
@@ -114,6 +116,13 @@ \section{Unicode}
114116
\code{'replace'} uses U+FFFD, the official replacement character, in
115117
case of any problems.
116118

119+
\item The \keyword{exec} statement, and various built-ins such as
120+
\code{eval()}, \code{getattr()}, and \code{setattr()} will also
121+
accept Unicode strings as well as regular strings. (It's possible
122+
that the process of fixing this missed some built-ins; if you find a
123+
built-in function that accepts strings but doesn't accept Unicode
124+
strings at all, please report it as a bug.)
125+
117126
\end{itemize}
118127

119128
A new module, \module{unicodedata}, provides an interface to Unicode
@@ -141,7 +150,7 @@ \section{Unicode}
141150
an 8-bit string and returning a 2-tuple \code{(\var{ustring},
142151
\var{length})}, consisting of the resulting Unicode string
143152
\var{ustring} and the integer \var{length} telling how much of the
144-
string was consumed.
153+
8-bit string was consumed.
145154

146155
\item \var{stream_reader} is a class that supports decoding input from
147156
a stream. \var{stream_reader(\var{file_obj})} returns an object that
@@ -670,8 +679,11 @@ \section{Porting to 2.0}
670679
or slice a sequence, and it'll behave as you'd intuitively expect it
671680
to; \code{3L * 'abc'} produces 'abcabcabc', and \code{
672681
(0,1,2,3)[2L:4L]} produces (2,3). Long integers can also be used in
673-
various new places where previously only integers were accepted, such
674-
as in the \method{seek()} method of file objects.
682+
various contexts where previously only integers were accepted, such
683+
as in the \method{seek()} method of file objects, and in the formats
684+
supported by the \verb|%| operator (\verb|%d|, \verb|%i|, \verb|%x|,
685+
etc.). For example, \code{"\%d" \% 2L**64} will produce the string
686+
\samp{18446744073709551616}.
675687

676688
The subtlest long integer change of all is that the \function{str()}
677689
of a long integer no longer has a trailing 'L' character, though
@@ -770,9 +782,22 @@ \section{Extending/Embedding Changes}
770782
Previously the Python virtual machine used 16-bit numbers in its
771783
bytecode, limiting the size of source files. In particular, this
772784
affected the maximum size of literal lists and dictionaries in Python
773-
source; occasionally people who are generating Python code would run into this limit.
774-
A patch by Charles G. Waldman raises the limit from \verb|2^16| to \verb|2^{32}|.
775-
785+
source; occasionally people who are generating Python code would run
786+
into this limit. A patch by Charles G. Waldman raises the limit from
787+
\verb|2^16| to \verb|2^{32}|.
788+
789+
Three new convenience functions intended for adding constants to a
790+
module's dictionary at module initialization time were added:
791+
\function{PyModule_AddObject()}, \function{PyModule_AddIntConstant()},
792+
and \function{PyModule_AddStringConstant()}. Each of these functions
793+
takes a module object, a null-terminated C string containing the name
794+
to be added, and a third argument for the value to be assigned to the
795+
name. This third argument is, respectively, a Python object, a C
796+
long, or a C string.
797+
798+
A wrapper API was added for Unix-style signal handlers.
799+
\function{PyOS_getsig()} gets a signal handler and
800+
\function{PyOS_setsig()} will set a new handler.
776801

777802
% ======================================================================
778803
\section{Distutils: Making Modules Easy to Install}
@@ -782,8 +807,10 @@ \section{Distutils: Making Modules Easy to Install}
782807
what compiler options to use for extension modules. Software authors
783808
had to go through an arduous ritual of editing Makefiles and
784809
configuration files, which only really work on Unix and leave Windows
785-
and MacOS unsupported. Software users faced wildly differing
786-
installation instructions
810+
and MacOS unsupported. Python users faced wildly differing
811+
installation instructions which varied between different extension
812+
packages, which made adminstering a Python installation something of a
813+
chore.
787814

788815
The SIG for distribution utilities, shepherded by Greg Ward, has
789816
created the Distutils, a system to make package installation much

0 commit comments

Comments
 (0)