Major Changes Between 1.3 and 1.5.2
This section describes significant language, library, tool, and C API changes in Python between the first edition of this book (Python 1.3) and Python release 1.5.2.
Core Language Changes
The following sections describe changes made to the Python language itself.
Pseudo-private class attributes
now provides a name-mangling protocol that hides attribute names used
by classes. Inside a class statement, a name of the form
_ _X is automatically changed by Python to
_Class_ _X , where
Class is the name of the
class being defined by the statement. Because the enclosing class
name is prepended, this feature limits the possibilities of name
clashes when you extend or mix existing classes. Note that this is
not a “private” mechanism at all, just a class name
localization feature to minimize name clashes in hierarchies and the
shared instance object’s namespace at the bottom of the
attribute inheritance links chain.
may now take the form of class (and class instance) objects. The
intent is to support exception categories. Because an
except clause will now match a raised exception if
it names the raised class or any of its superclasses, specifying
try statements to catch broad categories without listing all members explicitly (e.g., catching a numeric-error superclass exception will also catch specific kinds of numeric errors). Python’s standard built-in exceptions are now classes (instead of strings) ...