Normal
  ,   ˆl–Ü4ý() v( õõÀ»q¡)‹FÿÁ„p´ï_‡I|¥ŠèªÁÀ  )   �Zƒ›Ù«{‹„„-i[D<†ªo_’I|¥‰ÓMjqØ‚¦ð¬÷ÄÃ  $    ‹      sËÌIUÈË/QHË/ÍKÑã +�©!    ?÷     ****************************
  What's New in Python 2.2
****************************

:Author: A.M. Kuchling

.. |release| replace:: 1.02

.. $Id: whatsnew22.tex 37315 2004-09-10 19:33:00Z akuchling $


Introduction
============

This article explains the new features in Python 2.2.2, released on October 14,
2002.  Python 2.2.2 is a bugfix release of Python 2.2, originally released on
December 21, 2001.

Python 2.2 can be thought of as the "cleanup release".  There are some features
such as generators and iterators that are completely new, but most of the
changes, significant and far-reaching though they may be, are aimed at cleaning
up irregularities and dark corners of the language design.

This article doesn't attempt to provide a complete specification of the new
features, but instead provides a convenient overview.  For full details, you
should refer to the documentation for Python 2.2, such as the `Python Library
Reference <https://docs.python.org/2.2/lib/lib.html>`_ and the `Python
Reference Manual <https://docs.python.org/2.2/ref/ref.html>`_.  If you want to
understand the complete implementation and design rationale for a change, refer
to the PEP for a particular new feature.


.. see also, now defunct

   http://www.unixreview.com/documents/s=1356/urm0109h/0109h.htm
      "What's So Special About Python 2.2?" is also about the new 2.2 features, and
      was written by Cameron Laird and Kathryn Soraiz.

.. ======================================================================


PEPs 252 and 253: Type and Class Changes
========================================

The largest and most far-reaching changes in Python 2.2 are to Python's model of
objects and classes.  The changes should be backward compatible, so it's likely
that your code will continue to run unchanged, but the changes provide some
amazing new capabilities. Before beginning this, the longest and most
complicated section of this article, I'll provide an overview of the changes and
offer some comments.

A long time ago I wrote a Web page listing flaws in Python's design.  One of the
most significant flaws was that it's impossible to subclass Python types
implemented in C.  In particular, it's not possible to subclass built-in types,
so you can't just subclass, say, lists in order to add a single useful method to
them. The :mod:`UserList` module provides a class that supports all of the
methods of lists and that can be subclassed further, but there's lots of C code
that expects a regular Python list and won't accept a :class:`~UserList.UserList`
instance.

Python 2.2 fixes this, and in the process adds some exciting new capabilities.
A brief summary:

* You can subclass built-in types such as lists and even integers, and your
  subclasses should work in every place that requires the original type.

* It's now possible to define static and class methods, in addition to the
  instance methods available in previous versions of Python.

* It's also possible to automatically call methods on accessing or setting an
  instance attribute by using a new mechanism called :dfn:`properties`.  Many uses
  of :meth:`__getattr__` can be rewritten to use properties instead, making the
  resulting code simpler and faster.  As a small side benefit, attributes can now
  have docstrings, too.

* The list of legal attributes for an instance can be limited to a particular
  set using :dfn:`slots`, making it possible to safeguard against typos and
  perhaps make more optimizations possible in future versions of Python.

Some users have voiced concern about all these changes.  Sure, they say, the new
features are neat and lend themselves to all sorts of tricks that weren't
possible in previous versions of Python, but they also make the language more
complicated.  Some people have said that they've always recommended Python for
its simplicity, and feel that its simplicity is being lost.

Personally, I think there's no