mirror of https://github.com/python/cpython
Trim whitespace; add a few updates
This commit is contained in:
parent
0668c62677
commit
d207e230e1
|
@ -1436,6 +1436,18 @@ Here are all of the changes that Python 2.6 makes to the core Python language.
|
|||
|
||||
(Contributed by Alexander Belopolsky; :issue:`1686487`.)
|
||||
|
||||
It's also now legal to provide keyword arguments after a ``*args`` argument
|
||||
to a function call.
|
||||
|
||||
>>> def f(*args, **kw):
|
||||
... print args, kw
|
||||
...
|
||||
>>> f(1,2,3, *(4,5,6), keyword=13)
|
||||
(1, 2, 3, 4, 5, 6) {'keyword': 13}
|
||||
|
||||
Previously this would have been a syntax error.
|
||||
(Contributed by Amaury Forgeot d'Arc; :issue:`3473`.)
|
||||
|
||||
* A new built-in, ``next(*iterator*, [*default*])`` returns the next item
|
||||
from the specified iterator. If the *default* argument is supplied,
|
||||
it will be returned if *iterator* has been exhausted; otherwise,
|
||||
|
@ -1645,6 +1657,17 @@ Optimizations
|
|||
(Original optimization implemented by Armin Rigo, updated for
|
||||
Python 2.6 by Kevin Jacobs; :issue:`1700288`.)
|
||||
|
||||
By default, this change is only applied to types that are included with
|
||||
the Python core. Extension modules may not necessarily be compatible with
|
||||
this cache,
|
||||
so they must explicitly add :cmacro:`Py_TPFLAGS_HAVE_VERSION_TAG`
|
||||
to the module's ``tp_flags`` field to enable the method cache.
|
||||
(To be compatible with the method cache, the extension module's code
|
||||
must not directly access and modify the ``tp_dict`` member of
|
||||
any of the types it implements. Most modules don't do this,
|
||||
but it's impossible for the Python interpreter to determine that.
|
||||
See :issue:`1878` for some discussion.)
|
||||
|
||||
* Function calls that use keyword arguments
|
||||
are significantly faster thanks to a patch that does a quick pointer
|
||||
comparison, usually saving the time of a full string comparison.
|
||||
|
@ -2246,6 +2269,13 @@ details.
|
|||
time-consuming searches can now be interrupted.
|
||||
(Contributed by Josh Hoyt and Ralf Schmitt; :issue:`846388`.)
|
||||
|
||||
The regular expression module is implemented by compiling bytecodes
|
||||
for a tiny regex-specific virtual machine. Untrusted code
|
||||
could create malicious strings of bytecode directly and cause crashes,
|
||||
so Python 2.6 includes a verifier for the regex bytecode.
|
||||
(Contributed by Guido van Rossum from work for Google App Engine;
|
||||
:issue:`3487`.)
|
||||
|
||||
* The :mod:`rgbimg` module has been removed.
|
||||
|
||||
* The :mod:`rlcompleter` module's :meth:`Completer.complete()` method
|
||||
|
@ -2487,8 +2517,17 @@ details.
|
|||
|
||||
(Contributed by Dwayne Bailey; :issue:`1581073`.)
|
||||
|
||||
* The :mod:`threading` module's :class:`Thread` objects
|
||||
gained a :meth:`getIdent` method that returns the thread's
|
||||
* The :mod:`threading` module API is being changed for Python 3.0, to
|
||||
use properties such as :attr:`daemon` instead of :meth:`setDaemon`
|
||||
and :meth:`isDaemon` methods, and some methods have been renamed to
|
||||
use underscores instead of camel-case; for example, the
|
||||
:meth:`activeCount` method is renamed to :meth:`active_count`. The
|
||||
2.6 version of the module supports the same properties and renamed
|
||||
methods, but doesn't remove the old methods. (Carried out by
|
||||
various people, most notably Benjamin Peterson.)
|
||||
|
||||
The :mod:`threading` module's :class:`Thread` objects
|
||||
gained an :attr:`ident` property that returns the thread's
|
||||
identifier, a nonzero integer. (Contributed by Gregory P. Smith;
|
||||
:issue:`2871`.)
|
||||
|
||||
|
|
Loading…
Reference in New Issue