Changeset 391 for python/trunk/Doc/whatsnew/2.6.rst
- Timestamp:
- Mar 19, 2014, 11:31:01 PM (11 years ago)
- Location:
- python/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
python/trunk
-
Property svn:mergeinfo
set to
/python/vendor/Python-2.7.6 merged eligible /python/vendor/current merged eligible
-
Property svn:mergeinfo
set to
-
python/trunk/Doc/whatsnew/2.6.rst
r2 r391 6 6 7 7 :Author: A.M. Kuchling (amk at amk.ca) 8 :Release: |release| 9 :Date: |today| 10 11 .. $Id: 2.6.rst 78304 2010-02-22 14:55:17Z andrew.kuchling $ 8 9 .. $Id$ 12 10 Rules for maintenance: 13 11 … … 110 108 111 109 Python 3.0 adds several new built-in functions and changes the 112 semantics of some existing built -ins. Functions that are new in 3.0110 semantics of some existing builtins. Functions that are new in 3.0 113 111 such as :func:`bin` have simply been added to Python 2.6, but existing 114 built -ins haven't been changed; instead, the :mod:`future_builtins`112 builtins haven't been changed; instead, the :mod:`future_builtins` 115 113 module has versions with the new 3.0 semantics. Code written to be 116 114 compatible with 3.0 can do ``from future_builtins import hex, map`` as … … 122 120 code to 3.0. The value of this switch is available 123 121 to Python code as the boolean variable :data:`sys.py3kwarning`, 124 and to C extension code as :c data:`Py_Py3kWarningFlag`.122 and to C extension code as :c:data:`Py_Py3kWarningFlag`. 125 123 126 124 .. seealso:: … … 233 231 .. seealso:: 234 232 235 :ref:`documenting-index`233 `Documenting Python <http://docs.python.org/devguide/documenting.html>`__ 236 234 Describes how to write for Python's documentation. 237 235 … … 612 610 print 'Factorial', N, '=', result 613 611 614 A :class:`Queue` is used to communicate the input parameter *N* and615 the result.The :class:`Queue` object is stored in a global variable.612 A :class:`Queue` is used to communicate the result of the factorial. 613 The :class:`Queue` object is stored in a global variable. 616 614 The child process will use the value of the variable when the child 617 615 was created; because it's a :class:`Queue`, parent and child can use … … 834 832 return str(self) 835 833 836 There's also a :func:`format` built -in that will format a single834 There's also a :func:`format` builtin that will format a single 837 835 value. It calls the type's :meth:`__format__` method with the 838 836 provided specifier:: … … 976 974 977 975 At the C level, Python 3.0 will rename the existing 8-bit 978 string type, called :c type:`PyStringObject` in Python 2.x,979 to :c type:`PyBytesObject`. Python 2.6 uses ``#define``980 to support using the names :c func:`PyBytesObject`,981 :c func:`PyBytes_Check`, :cfunc:`PyBytes_FromStringAndSize`,976 string type, called :c:type:`PyStringObject` in Python 2.x, 977 to :c:type:`PyBytesObject`. Python 2.6 uses ``#define`` 978 to support using the names :c:func:`PyBytesObject`, 979 :c:func:`PyBytes_Check`, :c:func:`PyBytes_FromStringAndSize`, 982 980 and all the other functions and macros used with strings. 983 981 … … 1011 1009 1012 1010 There's also a corresponding C API, with 1013 :c func:`PyByteArray_FromObject`,1014 :c func:`PyByteArray_FromStringAndSize`,1011 :c:func:`PyByteArray_FromObject`, 1012 :c:func:`PyByteArray_FromStringAndSize`, 1015 1013 and various other functions. 1016 1014 … … 1068 1066 over an in-memory buffer. 1069 1067 1068 .. index:: 1069 single: universal newlines; What's new 1070 1070 1071 * :class:`TextIOBase`: Provides functions for reading and writing 1071 1072 strings (remember, strings will be Unicode in Python 3.0), 1072 and supporting universal newlines. :class:`TextIOBase` defines1073 and supporting :term:`universal newlines`. :class:`TextIOBase` defines 1073 1074 the :meth:`readline` method and supports iteration upon 1074 1075 objects. … … 1131 1132 .. XXX PyObject_GetBuffer not documented in c-api 1132 1133 1133 The *flags* argument to :c func:`PyObject_GetBuffer` specifies1134 The *flags* argument to :c:func:`PyObject_GetBuffer` specifies 1134 1135 constraints upon the memory returned. Some examples are: 1135 1136 … … 1142 1143 Fortran-contiguous (first dimension varies the fastest) array layout. 1143 1144 1144 Two new argument codes for :c func:`PyArg_ParseTuple`,1145 Two new argument codes for :c:func:`PyArg_ParseTuple`, 1145 1146 ``s*`` and ``z*``, return locked buffer objects for a parameter. 1146 1147 … … 1165 1166 containing a metaclass called :class:`ABCMeta`, special handling of 1166 1167 this metaclass by the :func:`isinstance` and :func:`issubclass` 1167 built -ins, and a collection of basic ABCs that the Python developers1168 builtins, and a collection of basic ABCs that the Python developers 1168 1169 think will be widely useful. Future versions of Python will probably 1169 1170 add more ABCs. … … 1319 1320 47 1320 1321 1321 The :func:`oct` built -in still returns numbers1322 The :func:`oct` builtin still returns numbers 1322 1323 prefixed with a leading zero, and a new :func:`bin` 1323 built -in returns the binary representation for a number::1324 builtin returns the binary representation for a number:: 1324 1325 1325 1326 >>> oct(42) … … 1330 1331 '0b10101101' 1331 1332 1332 The :func:`int` and :func:`long` built -ins will now accept the "0o"1333 The :func:`int` and :func:`long` builtins will now accept the "0o" 1333 1334 and "0b" prefixes when base-8 or base-2 are requested, or when the 1334 1335 *base* argument is zero (signalling that the base used should be … … 1416 1417 and can be used as array indexes and slice boundaries. 1417 1418 1418 In Python 3.0, the PEP slightly redefines the existing built -ins1419 In Python 3.0, the PEP slightly redefines the existing builtins 1419 1420 :func:`round`, :func:`math.floor`, :func:`math.ceil`, and adds a new 1420 1421 one, :func:`math.trunc`, that's been backported to Python 2.6. … … 1524 1525 (Contributed by Amaury Forgeot d'Arc; :issue:`3473`.) 1525 1526 1526 * A new built -in, ``next(iterator, [default])`` returns the next item1527 * A new builtin, ``next(iterator, [default])`` returns the next item 1527 1528 from the specified iterator. If the *default* argument is supplied, 1528 1529 it will be returned if *iterator* has been exhausted; otherwise, … … 1636 1637 assigning ``None`` was implemented as an override. At the 1637 1638 C level, extensions can set ``tp_hash`` to 1638 :c func:`PyObject_HashNotImplemented`.1639 :c:func:`PyObject_HashNotImplemented`. 1639 1640 (Fixed by Nick Coghlan and Amaury Forgeot d'Arc; :issue:`2235`.) 1640 1641 … … 1706 1707 the Python core. Extension modules may not necessarily be compatible with 1707 1708 this cache, 1708 so they must explicitly add :c macro:`Py_TPFLAGS_HAVE_VERSION_TAG`1709 so they must explicitly add :c:macro:`Py_TPFLAGS_HAVE_VERSION_TAG` 1709 1710 to the module's ``tp_flags`` field to enable the method cache. 1710 1711 (To be compatible with the method cache, the extension module's code … … 1789 1790 one patch.) 1790 1791 1791 * The :mod:`bsddb` module also has a new maintainer, Jesús Cea , and the package1792 * The :mod:`bsddb` module also has a new maintainer, Jesús Cea Avion, and the package 1792 1793 is now available as a standalone package. The web page for the package is 1793 1794 `www.jcea.es/programacion/pybsddb.htm … … 1953 1954 1954 1955 * The :func:`reduce` built-in function is also available in the 1955 :mod:`functools` module. In Python 3.0, the built -in has been1956 :mod:`functools` module. In Python 3.0, the builtin has been 1956 1957 dropped and :func:`reduce` is only available from :mod:`functools`; 1957 currently there are no plans to drop the built -in in the 2.x series.1958 currently there are no plans to drop the builtin in the 2.x series. 1958 1959 (Patched by Christian Heimes; :issue:`1739906`.) 1959 1960 … … 2192 2193 For example, ``os.path.splitext('.ipython')`` 2193 2194 now returns ``('.ipython', '')`` instead of ``('', '.ipython')``. 2194 (:issue:`11 5886`)2195 (:issue:`1115886`) 2195 2196 2196 2197 A new function, ``os.path.relpath(path, start='.')``, returns a relative path … … 2285 2286 2286 2287 * The :mod:`select` module now has wrapper functions 2287 for the Linux :c func:`epoll` and BSD :cfunc:`kqueue` system calls.2288 for the Linux :c:func:`epoll` and BSD :c:func:`kqueue` system calls. 2288 2289 :meth:`modify` method was added to the existing :class:`poll` 2289 2290 objects; ``pollobj.modify(fd, eventmask)`` takes a file descriptor … … 2318 2319 to be used; when a signal is received, a byte is written to that 2319 2320 file descriptor. There's also a C-level function, 2320 :c func:`PySignal_SetWakeupFd`, for setting the descriptor.2321 :c:func:`PySignal_SetWakeupFd`, for setting the descriptor. 2321 2322 2322 2323 Event loops will use this by opening a pipe to create two descriptors, … … 2324 2325 will be passed to :func:`set_wakeup_fd`, and the readable descriptor 2325 2326 will be added to the list of descriptors monitored by the event loop via 2326 :c func:`select` or :cfunc:`poll`.2327 :c:func:`select` or :c:func:`poll`. 2327 2328 On receiving a signal, a byte will be written and the main event loop 2328 2329 will be woken up, avoiding the need to poll. … … 2385 2386 version 2.4.1. 2386 2387 2387 * The :mod:`struct` module now supports the C99 :c type:`_Bool` type,2388 * The :mod:`struct` module now supports the C99 :c:type:`_Bool` type, 2388 2389 using the format character ``'?'``. 2389 2390 (Contributed by David Remahl.) … … 2393 2394 On Windows, :meth:`send_signal` only supports the :const:`SIGTERM` 2394 2395 signal, and all these methods are aliases for the Win32 API function 2395 :c func:`TerminateProcess`.2396 :c:func:`TerminateProcess`. 2396 2397 (Contributed by Christian Heimes.) 2397 2398 … … 2757 2758 * ``filter(predicate, iterable)``, 2758 2759 ``map(func, iterable1, ...)``: the 3.0 versions 2759 return iterators, unlike the 2.x built -ins which return lists.2760 return iterators, unlike the 2.x builtins which return lists. 2760 2761 2761 2762 * ``hex(value)``, ``oct(value)``: instead of calling the … … 2978 2979 * Python now must be compiled with C89 compilers (after 19 2979 2980 years!). This means that the Python source tree has dropped its 2980 own implementations of :c func:`memmove` and :cfunc:`strerror`, which2981 own implementations of :c:func:`memmove` and :c:func:`strerror`, which 2981 2982 are in the C89 standard library. 2982 2983 … … 3000 3001 * The new buffer interface, previously described in 3001 3002 `the PEP 3118 section <#pep-3118-revised-buffer-protocol>`__, 3002 adds :c func:`PyObject_GetBuffer` and :cfunc:`PyBuffer_Release`,3003 adds :c:func:`PyObject_GetBuffer` and :c:func:`PyBuffer_Release`, 3003 3004 as well as a few other functions. 3004 3005 … … 3008 3009 was reading from or writing to the object. In 2.6 file objects 3009 3010 have a reference count, manipulated by the 3010 :c func:`PyFile_IncUseCount` and :cfunc:`PyFile_DecUseCount`3011 :c:func:`PyFile_IncUseCount` and :c:func:`PyFile_DecUseCount` 3011 3012 functions. File objects can't be closed unless the reference count 3012 is zero. :c func:`PyFile_IncUseCount` should be called while the GIL3013 is zero. :c:func:`PyFile_IncUseCount` should be called while the GIL 3013 3014 is still held, before carrying out an I/O operation using the 3014 ``FILE *`` pointer, and :c func:`PyFile_DecUseCount` should be called3015 ``FILE *`` pointer, and :c:func:`PyFile_DecUseCount` should be called 3015 3016 immediately after the GIL is re-acquired. 3016 3017 (Contributed by Antoine Pitrou and Gregory P. Smith.) … … 3018 3019 * Importing modules simultaneously in two different threads no longer 3019 3020 deadlocks; it will now raise an :exc:`ImportError`. A new API 3020 function, :c func:`PyImport_ImportModuleNoBlock`, will look for a3021 function, :c:func:`PyImport_ImportModuleNoBlock`, will look for a 3021 3022 module in ``sys.modules`` first, then try to import it after 3022 3023 acquiring an import lock. If the import lock is held by another … … 3025 3026 3026 3027 * Several functions return information about the platform's 3027 floating-point support. :c func:`PyFloat_GetMax` returns3028 floating-point support. :c:func:`PyFloat_GetMax` returns 3028 3029 the maximum representable floating point value, 3029 and :c func:`PyFloat_GetMin` returns the minimum3030 positive value. :c func:`PyFloat_GetInfo` returns an object3030 and :c:func:`PyFloat_GetMin` returns the minimum 3031 positive value. :c:func:`PyFloat_GetInfo` returns an object 3031 3032 containing more information from the :file:`float.h` file, such as 3032 3033 ``"mant_dig"`` (number of digits in the mantissa), ``"epsilon"`` … … 3036 3037 3037 3038 * C functions and methods that use 3038 :c func:`PyComplex_AsCComplex` will now accept arguments that3039 :c:func:`PyComplex_AsCComplex` will now accept arguments that 3039 3040 have a :meth:`__complex__` method. In particular, the functions in the 3040 3041 :mod:`cmath` module will now accept objects with this method. … … 3050 3051 integers and strings to the module's dictionary in the 3051 3052 ``init*`` function. Python 2.6 finally defines standard macros 3052 for adding values to a module, :c macro:`PyModule_AddStringMacro`3053 and :c macro:`PyModule_AddIntMacro()`. (Contributed by3053 for adding values to a module, :c:macro:`PyModule_AddStringMacro` 3054 and :c:macro:`PyModule_AddIntMacro()`. (Contributed by 3054 3055 Christian Heimes.) 3055 3056 3056 3057 * Some macros were renamed in both 3.0 and 2.6 to make it clearer that 3057 3058 they are macros, 3058 not functions. :c macro:`Py_Size()` became :cmacro:`Py_SIZE()`,3059 :c macro:`Py_Type()` became :cmacro:`Py_TYPE()`, and3060 :c macro:`Py_Refcnt()` became :cmacro:`Py_REFCNT()`.3059 not functions. :c:macro:`Py_Size()` became :c:macro:`Py_SIZE()`, 3060 :c:macro:`Py_Type()` became :c:macro:`Py_TYPE()`, and 3061 :c:macro:`Py_Refcnt()` became :c:macro:`Py_REFCNT()`. 3061 3062 The mixed-case macros are still available 3062 3063 in Python 2.6 for backward compatibility. … … 3116 3117 * The :mod:`socket` module's socket objects now have an 3117 3118 :meth:`ioctl` method that provides a limited interface to the 3118 :c func:`WSAIoctl` system interface.3119 :c:func:`WSAIoctl` system interface. 3119 3120 3120 3121 * The :mod:`_winreg` module now has a function, … … 3262 3263 an :exc:`ImportError`. 3263 3264 3264 * C API: the :c func:`PyImport_Import` and :cfunc:`PyImport_ImportModule`3265 * C API: the :c:func:`PyImport_Import` and :c:func:`PyImport_ImportModule` 3265 3266 functions now default to absolute imports, not relative imports. 3266 3267 This will affect C extensions that import other modules. … … 3268 3269 * C API: extension data types that shouldn't be hashable 3269 3270 should define their ``tp_hash`` slot to 3270 :c func:`PyObject_HashNotImplemented`.3271 :c:func:`PyObject_HashNotImplemented`. 3271 3272 3272 3273 * The :mod:`socket` module exception :exc:`socket.error` now inherits
Note:
See TracChangeset
for help on using the changeset viewer.