Changeset 391 for python/trunk/Doc/whatsnew/2.2.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.2.rst
r2 r391 31 31 32 32 33 .. see also (now defunct)33 .. see also, now defunct 34 34 35 35 http://www.unixreview.com/documents/s=1356/urm0109h/0109h.htm … … 451 451 return a new iterator for the object; if the object is its own iterator, this 452 452 method can just return ``self``. In particular, iterators will usually be their 453 own iterators. Extension types implemented in C can implement a : attr:`tp_iter`453 own iterators. Extension types implemented in C can implement a :c:member:`~PyTypeObject.tp_iter` 454 454 function in order to return an iterator, and extension types that want to behave 455 as iterators can define a : attr:`tp_iternext` function.455 as iterators can define a :c:member:`~PyTypeObject.tp_iternext` function. 456 456 457 457 So, after all this, what do iterators actually do? They have one required … … 479 479 expects something for which :func:`iter` will return an iterator. For backward 480 480 compatibility and convenience, an iterator is automatically constructed for 481 sequences that don't implement :meth:`__iter__` or a : attr:`tp_iter` slot, so481 sequences that don't implement :meth:`__iter__` or a :c:member:`~PyTypeObject.tp_iter` slot, so 482 482 ``for i in [1,2,3]`` will still work. Wherever the Python interpreter loops 483 483 over a sequence, it's been changed to use the iterator protocol. This means you … … 755 755 * Classes can define methods called :meth:`__truediv__` and :meth:`__floordiv__` 756 756 to overload the two division operators. At the C level, there are also slots in 757 the :c type:`PyNumberMethods` structure so extension types can define the two757 the :c:type:`PyNumberMethods` structure so extension types can define the two 758 758 operators. 759 759 … … 984 984 985 985 * Two new format characters were added to the :mod:`struct` module for 64-bit 986 integers on platforms that support the C :c type:`long long` type. ``q`` is for986 integers on platforms that support the C :c:type:`long long` type. ``q`` is for 987 987 a signed 64-bit integer, and ``Q`` is for an unsigned one. The value is 988 988 returned in Python's long integer type. (Contributed by Tim Peters.) … … 1058 1058 of profiling and tracing. This will be of interest to authors of development 1059 1059 environments for Python. Two new C functions were added to Python's API, 1060 :c func:`PyEval_SetProfile` and :cfunc:`PyEval_SetTrace`. The existing1060 :c:func:`PyEval_SetProfile` and :c:func:`PyEval_SetTrace`. The existing 1061 1061 :func:`sys.setprofile` and :func:`sys.settrace` functions still exist, and have 1062 1062 simply been changed to use the new C-level interface. (Contributed by Fred L. … … 1064 1064 1065 1065 * Another low-level API, primarily of interest to implementors of Python 1066 debuggers and development tools, was added. :c func:`PyInterpreterState_Head` and1067 :c func:`PyInterpreterState_Next` let a caller walk through all the existing1068 interpreter objects; :c func:`PyInterpreterState_ThreadHead` and1069 :c func:`PyThreadState_Next` allow looping over all the thread states for a given1066 debuggers and development tools, was added. :c:func:`PyInterpreterState_Head` and 1067 :c:func:`PyInterpreterState_Next` let a caller walk through all the existing 1068 interpreter objects; :c:func:`PyInterpreterState_ThreadHead` and 1069 :c:func:`PyThreadState_Next` allow looping over all the thread states for a given 1070 1070 interpreter. (Contributed by David Beazley.) 1071 1071 … … 1079 1079 To upgrade an extension module to the new API, perform the following steps: 1080 1080 1081 * Rename :c func:`Py_TPFLAGS_GC` to :cfunc:`PyTPFLAGS_HAVE_GC`.1082 1083 * Use :c func:`PyObject_GC_New` or :cfunc:`PyObject_GC_NewVar` to allocate1084 objects, and :c func:`PyObject_GC_Del` to deallocate them.1085 1086 * Rename :c func:`PyObject_GC_Init` to :cfunc:`PyObject_GC_Track` and1087 :c func:`PyObject_GC_Fini` to :cfunc:`PyObject_GC_UnTrack`.1088 1089 * Remove :c func:`PyGC_HEAD_SIZE` from object size calculations.1090 1091 * Remove calls to :c func:`PyObject_AS_GC` and :cfunc:`PyObject_FROM_GC`.1092 1093 * A new ``et`` format sequence was added to :c func:`PyArg_ParseTuple`; ``et``1081 * Rename :c:func:`Py_TPFLAGS_GC` to :c:func:`PyTPFLAGS_HAVE_GC`. 1082 1083 * Use :c:func:`PyObject_GC_New` or :c:func:`PyObject_GC_NewVar` to allocate 1084 objects, and :c:func:`PyObject_GC_Del` to deallocate them. 1085 1086 * Rename :c:func:`PyObject_GC_Init` to :c:func:`PyObject_GC_Track` and 1087 :c:func:`PyObject_GC_Fini` to :c:func:`PyObject_GC_UnTrack`. 1088 1089 * Remove :c:func:`PyGC_HEAD_SIZE` from object size calculations. 1090 1091 * Remove calls to :c:func:`PyObject_AS_GC` and :c:func:`PyObject_FROM_GC`. 1092 1093 * A new ``et`` format sequence was added to :c:func:`PyArg_ParseTuple`; ``et`` 1094 1094 takes both a parameter and an encoding name, and converts the parameter to the 1095 1095 given encoding if the parameter turns out to be a Unicode string, or leaves it … … 1100 1100 support on Windows described in the following section.) 1101 1101 1102 * A different argument parsing function, :c func:`PyArg_UnpackTuple`, has been1102 * A different argument parsing function, :c:func:`PyArg_UnpackTuple`, has been 1103 1103 added that's simpler and presumably faster. Instead of specifying a format 1104 1104 string, the caller simply gives the minimum and maximum number of arguments 1105 expected, and a set of pointers to :c type:`PyObject\*` variables that will be1105 expected, and a set of pointers to :c:type:`PyObject\*` variables that will be 1106 1106 filled in with argument values. 1107 1107 … … 1112 1112 :const:`METH_OLDARGS` style of writing C methods is now officially deprecated. 1113 1113 1114 * Two new wrapper functions, :c func:`PyOS_snprintf` and :cfunc:`PyOS_vsnprintf`1114 * Two new wrapper functions, :c:func:`PyOS_snprintf` and :c:func:`PyOS_vsnprintf` 1115 1115 were added to provide cross-platform implementations for the relatively new 1116 :c func:`snprintf` and :cfunc:`vsnprintf` C lib APIs. In contrast to the standard1117 :c func:`sprintf` and :cfunc:`vsprintf` functions, the Python versions check the1116 :c:func:`snprintf` and :c:func:`vsnprintf` C lib APIs. In contrast to the standard 1117 :c:func:`sprintf` and :c:func:`vsprintf` functions, the Python versions check the 1118 1118 bounds of the buffer used to protect against buffer overruns. (Contributed by 1119 1119 M.-A. Lemburg.) 1120 1120 1121 * The :c func:`_PyTuple_Resize` function has lost an unused parameter, so now it1121 * The :c:func:`_PyTuple_Resize` function has lost an unused parameter, so now it 1122 1122 takes 2 parameters instead of 3. The third argument was never used, and can 1123 1123 simply be discarded when porting code from earlier versions to Python 2.2. … … 1220 1220 :meth:`tolist` method and the :attr:`start`, :attr:`stop`, and :attr:`step` 1221 1221 attributes are also being deprecated. At the C level, the fourth argument to 1222 the :c func:`PyRange_New` function, ``repeat``, has also been deprecated.1222 the :c:func:`PyRange_New` function, ``repeat``, has also been deprecated. 1223 1223 1224 1224 * There were a bunch of patches to the dictionary implementation, mostly to fix … … 1243 1243 in case they're also usable as modules. (Implemented by David Bolen.) 1244 1244 1245 * On platforms where Python uses the C :c func:`dlopen` function to load1246 extension modules, it's now possible to set the flags used by :c func:`dlopen`1245 * On platforms where Python uses the C :c:func:`dlopen` function to load 1246 extension modules, it's now possible to set the flags used by :c:func:`dlopen` 1247 1247 using the :func:`sys.getdlopenflags` and :func:`sys.setdlopenflags` functions. 1248 1248 (Contributed by Bram Stolk.)
Note:
See TracChangeset
for help on using the changeset viewer.