mirror of https://github.com/python/cpython
Add items
This commit is contained in:
parent
abfd8dff3b
commit
6edff59e3b
|
@ -515,6 +515,12 @@ fixes. Here's a partial list of the most notable changes, sorted alphabetically
|
|||
by module name. Consult the :file:`Misc/NEWS` file in the source tree for a more
|
||||
complete list of changes, or look through the CVS logs for all the details.
|
||||
|
||||
* The :mod:`bsddb.dbshelve` module now uses the highest pickling protocol
|
||||
available, instead of restricting itself to protocol 1.
|
||||
(Contributed by W. Barnes.)
|
||||
|
||||
.. % Patch 1551443
|
||||
|
||||
* A new data type in the :mod:`collections` module: :class:`named_tuple(typename,
|
||||
fieldnames)` is a factory function that creates subclasses of the standard tuple
|
||||
whose fields are accessible by name as well as index. For example::
|
||||
|
@ -531,17 +537,48 @@ complete list of changes, or look through the CVS logs for all the details.
|
|||
1 1
|
||||
>>> print var[2], var.type # Equivalent
|
||||
int int
|
||||
>>> var.__asdict__()
|
||||
{'size': 4, 'type': 'int', 'id': 1, 'name': 'frequency'}
|
||||
>>> v2 = var.__replace__('name', 'amplitude')
|
||||
>>> v2
|
||||
variable(id=1, name='amplitude', type='int', size=4)
|
||||
|
||||
(Contributed by Raymond Hettinger.)
|
||||
|
||||
* Another change to the :mod:`collections` module is that the
|
||||
:class:`deque` type now supports an optional `maxlen` parameter;
|
||||
if supplied, the deque's size will be restricted to no more
|
||||
than ``maxlen`` items. Adding more items to a full deque causes
|
||||
old items to be discarded.
|
||||
|
||||
::
|
||||
|
||||
>>> from collections import deque
|
||||
>>> dq=deque(maxlen=3)
|
||||
>>> dq
|
||||
deque([], maxlen=3)
|
||||
>>> dq.append(1) ; dq.append(2) ; dq.append(3)
|
||||
>>> dq
|
||||
deque([1, 2, 3], maxlen=3)
|
||||
>>> dq.append(4)
|
||||
>>> dq
|
||||
deque([2, 3, 4], maxlen=3)
|
||||
|
||||
(Contributed by Raymond Hettinger.)
|
||||
|
||||
* The :mod:`ctypes` module now supports a :class:`c_bool` datatype
|
||||
that represents the C99 ``bool`` type. (Contributed by David Remahl.)
|
||||
|
||||
.. % Patch 1649190
|
||||
|
||||
The :mod:`ctypes` string, buffer and array types also have improved
|
||||
support for extended slicing syntax,
|
||||
where various combinations of ``(start, stop, step)`` are supplied.
|
||||
(Implemented by Thomas Wouters.)
|
||||
|
||||
.. % Revision 57769
|
||||
|
||||
|
||||
* A new method in the :mod:`curses` module: for a window, :meth:`chgat` changes
|
||||
the display characters for a certain number of characters on a single line.
|
||||
::
|
||||
|
@ -626,6 +663,12 @@ complete list of changes, or look through the CVS logs for all the details.
|
|||
|
||||
.. % Patch 1273829
|
||||
|
||||
* The ``os.environ`` object's :meth:`clear` method will now unset the
|
||||
environment variables using :func:`os.unsetenv` in addition to clearing
|
||||
the object's keys. (Contributed by XXX.)
|
||||
|
||||
.. % Patch #1181
|
||||
|
||||
* In the :mod:`os.path` module, the :func:`splitext` function
|
||||
has been changed to not split on leading period characters.
|
||||
This produces better results when operating on Unix's dot-files.
|
||||
|
@ -799,7 +842,13 @@ Build and C API Changes
|
|||
|
||||
Changes to Python's build process and to the C API include:
|
||||
|
||||
* Detailed changes will be listed here.
|
||||
* The BerkeleyDB module now has a C API object, available as
|
||||
``bsddb.db.api``. This object can be used by other C extensions
|
||||
that wish to use the :mod:`bsddb` module for their own purposes.
|
||||
(Contributed by Duncan Grisby.)
|
||||
|
||||
.. % Patch 1551895
|
||||
|
||||
|
||||
.. % ======================================================================
|
||||
|
||||
|
|
Loading…
Reference in New Issue