@@ -72,8 +72,6 @@ new feature.
7272 Python 3.0
7373================
7474
75- .. % XXX add general comment about Python 3.0 features in 2.6
76-
7775The development cycle for Python 2.6 also saw the release of the first
7876alphas of Python 3.0, and the development of 3.0 has influenced
7977a number of features in 2.6.
9593A new command-line switch, :option: `-3 `, enables warnings
9694about features that will be removed in Python 3.0. You can run code
9795with this switch to see how much work will be necessary to port
98- code to 3.0.
96+ code to 3.0. The value of this switch is available
97+ to Python code as the boolean variable ``sys.py3kwarning ``,
98+ and to C extension code as :cdata: `Py_Py3kWarningFlag `.
9999
100100.. seealso ::
101101
102102 The 3xxx series of PEPs, which describes the development process for
103103 Python 3.0 and various features that have been accepted, rejected,
104104 or are still under consideration.
105105
106+
107+ Development Changes
108+ ==================================================
109+
110+ While 2.6 was being developed, the Python development process
111+ underwent two significant changes: the developer group
112+ switched from SourceForge's issue tracker to a customized
113+ Roundup installation, and the documentation was converted from
114+ LaTeX to reStructured Text.
115+
116+
117+ New Issue Tracker: Roundup
118+ --------------------------------------------------
119+
120+ XXX write this.
121+
122+
123+ New Documentation Format: ReStructured Text
124+ --------------------------------------------------
125+
126+ Python's documentation had been written using LaTeX since the
127+ project's inception around 1989. At that time, most documentation was
128+ printed out for later study, not viewed online. LaTeX was widely used
129+ because it provided attractive printed output while
130+ remaining straightforward to write, once the basic rules
131+ of the markup have been learned.
132+
133+ LaTeX is still used today for writing technical publications destined
134+ for printing, but the landscape for programming tools has shifted. We
135+ no longer print out reams of documentation; instead, we browse through
136+ it online and HTML is the most important format to support.
137+ Unfortunately, converting LaTeX to HTML is fairly complicated, and
138+ Fred L. Drake Jr., the Python documentation editor for many years,
139+ spent a lot of time wrestling the conversion process into shape.
140+ Occasionally people would suggest converting the documentation into
141+ SGML or, later, XML, but performing a good conversion is a major task
142+ and no one pursued the task to completion.
143+
144+ During the 2.6 development cycle, Georg Brandl put a substantial
145+ effort into building a new toolchain called Sphinx
146+ for processing the documentation.
147+ The input format is reStructured Text,
148+ a markup commonly used in the Python community that supports
149+ custom extensions and directives. Sphinx concentrates
150+ on its HTML output, producing attractively styled
151+ and modern HTML. (XXX finish this -- mention new search feature)
152+
153+ .. seealso ::
154+
155+ `Docutils <http://docutils.sf.net >`__: The fundamental
156+ reStructured Text parser and toolset.
157+
158+ `Documenting Python <XXX >`__: Describes how to write for
159+ Python's documentation.
160+
161+
106162PEP 343: The 'with' statement
107163=============================
108164
@@ -352,6 +408,24 @@ bound to a variable, and calls ``object.close`` at the end of the block. ::
352408
353409.. % ======================================================================
354410
411+ .. _pep-0366 :
412+
413+ PEP 366: Explicit Relative Imports From a Main Module
414+ ============================================================
415+
416+ Python's :option: `-m ` switch allows running a module as a script.
417+ When you ran a module that was located inside a package, relative
418+ imports didn't work correctly.
419+
420+ The fix in Python 2.6 adds a :attr: `__package__ ` attribute to modules.
421+ When present, relative imports will be relative to the value of this
422+ attribute instead of the :attr: `__name__ ` attribute. PEP 302-style
423+ importers can then set :attr: `__package__ `. The :mod: `runpy ` module
424+ that implements the :option: `-m ` switch now does this, so relative imports
425+ can now be used in scripts running from inside a package.
426+
427+ .. % ======================================================================
428+
355429 .. _pep-3110 :
356430
357431PEP 3110: Exception-Handling Changes
414488 :pep: `3119 ` - Introducing Abstract Base Classes
415489 PEP written by Guido van Rossum and Talin.
416490 Implemented by XXX.
417- Backported to 2.6 by Benjamin Aranguren ( with Alex Martelli) .
491+ Backported to 2.6 by Benjamin Aranguren, with Alex Martelli.
418492
419493Other Language Changes
420494======================
@@ -443,6 +517,25 @@ Here are all of the changes that Python 2.6 makes to the core Python language.
443517
444518 .. % Revision 57619
445519
520+ * Properties now have two attributes,
521+ :attr: `setter ` and :attr: `deleter `, that are useful shortcuts for
522+ adding a setter or deleter function to an existing property.
523+ You would use them like this::
524+
525+ class C(object):
526+ @property
527+ def x(self):
528+ return self._x
529+
530+ @x.setter
531+ def x(self, value):
532+ self._x = value
533+
534+ @x.deleter
535+ def x(self):
536+ del self._x
537+
538+
446539* C functions and methods that use
447540 :cfunc: `PyComplex_AsCComplex ` will now accept arguments that
448541 have a :meth: `__complex__ ` method. In particular, the functions in the
@@ -452,11 +545,26 @@ Here are all of the changes that Python 2.6 makes to the core Python language.
452545
453546 .. % Patch #1675423
454547
548+ A numerical nicety: when creating a complex number from two floats
549+ on systems that support signed zeros (-0 and +0), the
550+ :func: `complex() ` constructor will now preserve the sign
551+ of the zero.
552+
553+ .. % Patch 1507
554+
455555 * Changes to the :class: `Exception ` interface
456556 as dictated by :pep: `352 ` continue to be made. For 2.6,
457557 the :attr: `message ` attribute is being deprecated in favor of the
458558 :attr: `args ` attribute.
459559
560+ * The :exc: `GeneratorExit ` exception now subclasses
561+ :exc: `BaseException ` instead of :exc: `Exception `. This means
562+ that an exception handler that does ``except Exception: ``
563+ will not inadvertently catch :exc: `GeneratorExit `.
564+ (Contributed by Chad Austin.)
565+
566+ .. % Patch #1537
567+
460568 * The :func: `compile ` built-in function now accepts keyword arguments
461569 as well as positional parameters. (Contributed by Thomas Wouters.)
462570
@@ -653,6 +761,20 @@ complete list of changes, or look through the CVS logs for all the details.
653761
654762 .. % Patch #1490190
655763
764+ * The :mod: `new ` module has been removed from Python 3.0.
765+ Importing it therefore
766+ triggers a warning message when Python is running in 3.0-warning
767+ mode.
768+
769+ * New functions in the :mod: `os ` module include
770+ ``fchmod(fd, mode) ``, ``fchown(fd, uid, gid) ``,
771+ and ``lchmod(path, mode) ``, on operating systems that support these
772+ functions. :func: `fchmod ` and :func: `fchown ` let you change the mode
773+ and ownership of an opened file, and :func: `lchmod ` changes the mode
774+ of a symlink.
775+
776+ (Contributed by Georg Brandl and Christian Heimes.)
777+
656778* The :func: `os.walk ` function now has a ``followlinks `` parameter. If
657779 set to True, it will follow symlinks pointing to directories and
658780 visit the directory's contents. For backward compatibility, the
@@ -703,6 +825,15 @@ complete list of changes, or look through the CVS logs for all the details.
703825 changed and :const: `UF_APPEND ` to indicate that data can only be appended to the
704826 file. (Contributed by M. Levinson.)
705827
828+ * The :mod: `random ` module's :class: `Random ` objects can
829+ now be pickled on a 32-bit system and unpickled on a 64-bit
830+ system, and vice versa. Unfortunately, this change also means
831+ that Python 2.6's :class: `Random ` objects can't be unpickled correctly
832+ on earlier versions of Python.
833+ (Contributed by Shawn Ligocki.)
834+
835+ .. % Issue 1727780
836+
706837 * The :mod: `rgbimg ` module has been removed.
707838
708839* The :mod: `sets ` module has been deprecated; it's better to
@@ -725,6 +856,17 @@ complete list of changes, or look through the CVS logs for all the details.
725856
726857 .. % Patch #957003
727858
859+ * A new variable in the :mod: `sys ` module,
860+ :attr: `float_info `, is a dictionary
861+ containing information about the platform's floating-point support
862+ derived from the :file: `float.h ` file. Key/value pairs
863+ in this dictionary include
864+ ``"mant_dig" `` (number of digits in the mantissa), ``"epsilon" ``
865+ (smallest difference between 1.0 and the next largest value
866+ representable), and several others. (Contributed by Christian Heimes.)
867+
868+ .. % Patch 1534
869+
728870 * The :mod: `tarfile ` module now supports POSIX.1-2001 (pax) and
729871 POSIX.1-1988 (ustar) format tarfiles, in addition to the GNU tar
730872 format that was already supported. The default format
@@ -883,6 +1025,17 @@ Changes to Python's build process and to the C API include:
8831025
8841026 .. % Patch 1551895
8851027
1028+ * Several functions return information about the platform's
1029+ floating-point support. :cfunc: `PyFloat_GetMax ` returns
1030+ the maximum representable floating point value,
1031+ and :cfunc: `PyFloat_GetMin ` returns the minimum
1032+ positive value. :cfunc: `PyFloat_GetInfo ` returns a dictionary
1033+ containing more information from the :file: `float.h ` file, such as
1034+ ``"mant_dig" `` (number of digits in the mantissa), ``"epsilon" ``
1035+ (smallest difference between 1.0 and the next largest value
1036+ representable), and several others.
1037+
1038+ .. % Issue 1534
8861039
8871040.. % ======================================================================
8881041
0 commit comments