Commit 2cd712b8 authored by Andrew M. Kuchling's avatar Andrew M. Kuchling

Write some entries in the "Other changes" section

Write description of .encode()/.decode for the Unicode section
Bump version number
parent d65ca723
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
% $Id$ % $Id$
\title{What's New in Python 2.2} \title{What's New in Python 2.2}
\release{0.01} \release{0.02}
\author{A.M. Kuchling} \author{A.M. Kuchling}
\authoraddress{\email{akuchlin@mems-exchange.org}} \authoraddress{\email{akuchlin@mems-exchange.org}}
\begin{document} \begin{document}
...@@ -317,8 +317,42 @@ Schemenauer, with fixes from the Python Labs crew.} ...@@ -317,8 +317,42 @@ Schemenauer, with fixes from the Python Labs crew.}
%====================================================================== %======================================================================
\section{Unicode Changes} \section{Unicode Changes}
XXX I have to figure out what the changes mean to users. Python's Unicode support has been enhanced a bit in 2.2. Unicode
(--enable-unicode configure switch) strings are usually stored as UCS-2, as 16-bit unsigned integers.
Python 2.2 can also be compiled to use UCS-4, 32-bit unsigned integers
by supplying \code{--enable-unicode=ucs4} to the configure script.
XXX explain surrogates? I have to figure out what the changes mean to users.
Since their introduction, Unicode strings (XXX and regular strings in
2.1?) have supported an \method{encode()} method to convert the
string to a selected encoding such as UTF-8 or Latin-1. A symmetric
\method{decode(\optional{\var{encoding}})} method has been added to
both 8-bit and Unicode strings in 2.2, which assumes that the string
is in the specified encoding and decodes it. This means that
\method{encode()} and \method{decode()} can be called on both types of
strings, and can be used for tasks not directly related to Unicode.
For example, codecs have been added for UUencoding, MIME's base-64
encoding, and compression with the \module{zlib} module.
\begin{verbatim}
>>> s = """Here is a lengthy piece of redundant, overly verbose,
... and repetitive text.
... """
>>> data = s.encode('zlib')
>>> data
'x\x9c\r\xc9\xc1\r\x80 \x10\x04\xc0?Ul...'
>>> data.decode('zlib')
'Here is a lengthy piece of redundant, overly verbose,\nand repetitive text.\n'
>>> print s.encode('uu')
begin 666 <data>
M2&5R92!I<R!A(&QE;F=T:'D@<&EE8V4@;V8@<F5D=6YD86YT+"!O=F5R;'D@
>=F5R8F]S92P*86YD(')E<&5T:71I=F4@=&5X="X*
end
>>> "sheesh".encode('rot-13')
'furrfu'
\end{verbatim}
References: http://mail.python.org/pipermail/i18n-sig/2001-June/001107.html References: http://mail.python.org/pipermail/i18n-sig/2001-June/001107.html
and following thread. and following thread.
...@@ -510,58 +544,53 @@ changes are: ...@@ -510,58 +544,53 @@ changes are:
\begin{itemize} \begin{itemize}
\item XXX C API: Reorganization of object calling \item Keyword arguments passed to builtin functions that don't take them
now cause a \exception{TypeError} exception to be raised, with the
\item XXX .encode(), .decode() string methods. Interesting new codecs such message "\var{function} takes no keyword arguments".
as zlib.
\item The code for the MacOS port for Python, maintained by Jack
\item MacOS code now in main CVS tree. Jansen, is now kept in the main Python CVS tree.
\item SF patch \#418147 Fixes to allow compiling w/ Borland, from Stephen Hansen. \item The new license introduced with Python 1.6 wasn't
GPL-compatible. This is fixed by some minor textual changes to the
\item Add support for Windows using "mbcs" as the default Unicode encoding when dealing with the file system. As discussed on python-dev and in patch 410465. 2.2 license, so Python can now be embedded inside a GPLed program
again. The license changes were also applied to the Python 2.0.1
\item Lots of patches to dictionaries; measure performance improvement, if any. and 2.1.1 releases.
\item Patch \#430754: Makes ftpmirror.py .netrc aware \item Profiling and tracing functions can now be implemented in C,
which can operate at much higher speeds than Python-based functions
\item Fix bug reported by Tim Peters on python-dev: and should reduce the overhead of enabling profiling and tracing, so
it will be of interest to authors of development environments for
Keyword arguments passed to builtin functions that don't take them are Python. Two new C functions were added to Python's API,
ignored. \cfunction{PyEval_SetProfile()} and \cfunction{PyEval_SetTrace()}.
The existing \function{sys.setprofile()} and \function{sys.settrace()}
>>> {}.clear(x=2) functions still exist, and have simply been changed to use the new
>>> C-level interface.
instead of
\item The \file{Tools/scripts/ftpmirror.py} script
>>> {}.clear(x=2) now parses a \file{.netrc} file, if you have one.
Traceback (most recent call last): (Contributed by XXX.) Patch \#430754: Makes ftpmirror.py .netrc aware
File "<stdin>", line 1, in ?
TypeError: clear() takes no keyword arguments \item Some features of the object returned by the \function{xrange()}
function are now deprecated, and trigger warnings when they're
\item Make the license GPL-compatible. accessed; they'll disappear in Python 2.3. \class{xrange} objects
tried to pretend they were full sequence types by supporting slicing,
\item This change adds two new C-level APIs: PyEval_SetProfile() and sequence multiplication, and the \keyword{in} operator, but these
PyEval_SetTrace(). These can be used to install profile and trace features were rarely used and therefore buggy. (The implementation of
functions implemented in C, which can operate at much higher speeds the \keyword{in} operator had an off-by-one error introduced in Python
than Python-based functions. The overhead for calling a C-based XXX that no one noticed until XXX, XXX years later. The
profile function is a very small fraction of a percent of the overhead \method{tolist()} method and the \member{start}, \member{stop}, and
involved in calling a Python-based function. \member{step} attributes are also being deprecated. At the C level,
the fourth argument to the \cfunction{PyRange_New()} function,
The machinery required to call a Python-based profile or trace \samp{repeat}, has also been deprecated.
function been moved to sysmodule.c, where sys.setprofile() and
sys.setprofile() simply become users of the new interface.
\item 'Advanced' xrange() features now deprecated: repeat, slice,
contains, tolist(), and the start/stop/step attributes. This includes
removing the 4th ('repeat') argument to PyRange_New().
\item XXX C API: Reorganization of object calling
\item The call_object() function, originally in ceval.c, begins a new life The call_object()
%as the official API PyObject_Call(). It is also much simplified: all function, originally in ceval.c, begins a new life as the official
%it does is call the tp_call slot, or raise an exception if that's API PyObject_Call(). It is also much simplified: all it does is call
%NULL. the tp_call slot, or raise an exception if that's NULL.
%The subsidiary functions (call_eval_code2(), call_cfunction(), %The subsidiary functions (call_eval_code2(), call_cfunction(),
%call_instance(), and call_method()) have all been moved to the file %call_instance(), and call_method()) have all been moved to the file
...@@ -576,6 +605,12 @@ removing the 4th ('repeat') argument to PyRange_New(). ...@@ -576,6 +605,12 @@ removing the 4th ('repeat') argument to PyRange_New().
%PyEval_GetFuncDesc(), PyEval_EvalCodeEx() (formerly get_func_name(), %PyEval_GetFuncDesc(), PyEval_EvalCodeEx() (formerly get_func_name(),
%get_func_desc(), and eval_code2(). %get_func_desc(), and eval_code2().
\item XXX SF patch \#418147 Fixes to allow compiling w/ Borland, from Stephen Hansen.
\item XXX Add support for Windows using "mbcs" as the default Unicode encoding when dealing with the file system. As discussed on python-dev and in patch 410465.
\item XXX Lots of patches to dictionaries; measure performance improvement, if any.
\end{itemize} \end{itemize}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment