22 What's New in Python 3.0
33****************************
44
5+ .. XXX add trademark info for Apple, Microsoft, SourceForge.
6+
57:Author: Guido van Rossum
6- :Release: 0.1
8+ :Release: |release |
9+ :Date: |today |
710
8- .. Rules for maintenance:
11+ .. $Id$
12+ Rules for maintenance:
913
1014 * Anyone can add text to this document. Do not spend very much time
1115 on the wording of your changes, because your text will probably
4650 This saves the maintainer the effort of going through the SVN log
4751 when researching a change.
4852
49- This article explains the new features in Python 3.0, comparing to 2.6
50- (or in some cases 2.5, since 2.6 isn't released yet).
51-
52- The best estimate for a release date is August 2008.
53+ This article explains the new features in Python 3.0, comparing to 2.6.
54+ In some cases it will also summarize changes since 2.5, with a reference
55+ to "What's New in Python 2.6" for the details. Python 2.6 was released
56+ on October 1 2008. Python 3.0 will be released in December 2008.
5357
5458This article doesn't attempt to provide a complete specification of
5559the new features, but instead provides a convenient overview. For
@@ -131,6 +135,17 @@ changes to rarely used features.)
131135 that if a file is opened using an incorrect mode or encoding, I/O
132136 will likely fail.
133137
138+ * The ordering comparison operators (``< ``, ``<= ``, ``>= ``, ``> ``)
139+ raise a TypeError exception when the operands don't have a
140+ meaningful natural ordering. Thus, expressions like ``1 < '' ``, ``0
141+ > None `` or ``len < len `` are no longer valid. A corollary is that
142+ sorting a heterogeneous list no longer makes sense -- all the
143+ elements must be comparable to each other. Note that this does not
144+ apply to the ``== `` and ``!= `` operators: objects of different
145+ uncomparable types always compare unequal to each other, and an
146+ object always compares equal to itself (i.e., ``x is y `` implies ``x
147+ = y ``; this is true even for ``NaN ``).
148+
134149* :func: `map ` and :func: `filter ` return iterators. A quick fix is e.g.
135150 ``list(map(...)) ``, but a better fix is often to use a list
136151 comprehension (especially when the original code uses :keyword: `lambda `).
@@ -147,6 +162,8 @@ changes to rarely used features.)
147162
148163* ``1/2 `` returns a float. Use ``1//2 `` to get the truncating behavior.
149164
165+ .. XXX move the next one to a later point, it's not a common stumbling block.
166+
150167 * The :func: `repr ` of a long integer doesn't include the trailing ``L ``
151168 anymore, so code that unconditionally strips that character will
152169 chop off the last digit instead.
@@ -168,7 +185,7 @@ Strings and Bytes
168185 or :meth: `bytes.decode ` (bytes -> str) methods.
169186
170187* All backslashes in raw strings are interpreted literally. This means that
171- Unicode escapes are not treated specially.
188+ `` '\U' `` and `` '\u' `` escapes in raw strings are not treated specially.
172189
173190.. XXX add bytearray
174191
@@ -186,16 +203,17 @@ Strings and Bytes
186203* The :mod: `StringIO ` and :mod: `cStringIO ` modules are gone. Instead, import
187204 :class: `io.StringIO ` or :class: `io.BytesIO `.
188205
189- * ``'\U' `` and ``'\u' `` escapes in raw strings are not treated specially.
190206
191207
192208PEP 3101: A New Approach to String Formatting
193209=============================================
194210
195- .. XXX expand this
211+ * A new system for built-in string formatting operations replaces the
212+ ``% `` string formatting operator. (However, the ``% `` operator is
213+ still supported; it will be deprecated in Python 3.1 and removed
214+ from the language at some later time.)
196215
197- * A new system for built-in string formatting operations replaces the ``% ``
198- string formatting operator.
216+ .. XXX expand this
199217
200218
201219 PEP 3106: Revamping dict :meth: `dict.keys `, :meth: `dict.items ` and :meth: `dict.values `
@@ -207,7 +225,8 @@ PEP 3106: Revamping dict :meth:`dict.keys`, :meth:`dict.items` and :meth:`dict.v
207225 methods have been removed.
208226
209227* :meth: `dict.keys `, :meth: `dict.values ` and :meth: `dict.items ` return objects
210- with set behavior that reference the underlying dict.
228+ with set behavior that reference the underlying dict; these are often
229+ referred to as *dictionary views *.
211230
212231
213232PEP 3107: Function Annotations
0 commit comments