2018-07-04 09:06:45 +00:00
|
|
|
|
# Copyright (C) 2001-2018, Python Software Foundation
|
2018-07-04 09:08:42 +00:00
|
|
|
|
# For licence information, see README file.
|
2016-10-30 09:46:26 +00:00
|
|
|
|
#
|
|
|
|
|
msgid ""
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Project-Id-Version: Python 3.6\n"
|
|
|
|
|
"Report-Msgid-Bugs-To: \n"
|
2018-06-10 09:32:30 +00:00
|
|
|
|
"POT-Creation-Date: 2018-06-10 11:27+0200\n"
|
2018-08-03 07:37:42 +00:00
|
|
|
|
"PO-Revision-Date: 2018-08-01 00:06+0200\n"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
2018-07-04 09:14:25 +00:00
|
|
|
|
"Language-Team: FRENCH <traductions@lists.afpy.org>\n"
|
2017-05-23 22:40:56 +00:00
|
|
|
|
"Language: fr\n"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
"MIME-Version: 1.0\n"
|
|
|
|
|
"Content-Type: text/plain; charset=UTF-8\n"
|
|
|
|
|
"Content-Transfer-Encoding: 8bit\n"
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:3
|
|
|
|
|
msgid "What's New in Python 2.4"
|
|
|
|
|
msgstr "Nouveautés de Python 2.4"
|
|
|
|
|
|
2018-05-01 22:20:18 +00:00
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:0
|
|
|
|
|
msgid "Author"
|
2018-07-03 09:14:42 +00:00
|
|
|
|
msgstr "Auteur"
|
2018-05-01 22:20:18 +00:00
|
|
|
|
|
2016-10-30 09:46:26 +00:00
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:5
|
|
|
|
|
msgid "A.M. Kuchling"
|
|
|
|
|
msgstr "A.M. Kuchling"
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:14
|
|
|
|
|
msgid ""
|
|
|
|
|
"This article explains the new features in Python 2.4.1, released on March "
|
|
|
|
|
"30, 2005."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:17
|
|
|
|
|
msgid ""
|
|
|
|
|
"Python 2.4 is a medium-sized release. It doesn't introduce as many changes "
|
|
|
|
|
"as the radical Python 2.2, but introduces more features than the "
|
|
|
|
|
"conservative 2.3 release. The most significant new language features are "
|
|
|
|
|
"function decorators and generator expressions; most other changes are to the "
|
|
|
|
|
"standard library."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:22
|
|
|
|
|
msgid ""
|
|
|
|
|
"According to the CVS change logs, there were 481 patches applied and 502 "
|
|
|
|
|
"bugs fixed between Python 2.3 and 2.4. Both figures are likely to be "
|
|
|
|
|
"underestimates."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:25
|
|
|
|
|
msgid ""
|
|
|
|
|
"This article doesn't attempt to provide a complete specification of every "
|
|
|
|
|
"single new feature, but instead provides a brief introduction to each "
|
|
|
|
|
"feature. For full details, you should refer to the documentation for Python "
|
|
|
|
|
"2.4, such as the Python Library Reference and the Python Reference Manual. "
|
|
|
|
|
"Often you will be referred to the PEP for a particular new feature for "
|
|
|
|
|
"explanations of the implementation and design rationale."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:36
|
|
|
|
|
msgid "PEP 218: Built-In Set Objects"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:38
|
|
|
|
|
msgid ""
|
|
|
|
|
"Python 2.3 introduced the :mod:`sets` module. C implementations of set data "
|
|
|
|
|
"types have now been added to the Python core as two new built-in types, "
|
|
|
|
|
"``set(iterable)`` and ``frozenset(iterable)``. They provide high speed "
|
|
|
|
|
"operations for membership testing, for eliminating duplicates from "
|
|
|
|
|
"sequences, and for mathematical operations like unions, intersections, "
|
|
|
|
|
"differences, and symmetric differences. ::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:71
|
|
|
|
|
msgid ""
|
|
|
|
|
"The :func:`frozenset` type is an immutable version of :func:`set`. Since it "
|
|
|
|
|
"is immutable and hashable, it may be used as a dictionary key or as a member "
|
|
|
|
|
"of another set."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:75
|
|
|
|
|
msgid ""
|
|
|
|
|
"The :mod:`sets` module remains in the standard library, and may be useful if "
|
|
|
|
|
"you wish to subclass the :class:`Set` or :class:`ImmutableSet` classes. "
|
|
|
|
|
"There are currently no plans to deprecate the module."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:83
|
|
|
|
|
msgid ":pep:`218` - Adding a Built-In Set Object Type"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:83
|
|
|
|
|
msgid ""
|
|
|
|
|
"Originally proposed by Greg Wilson and ultimately implemented by Raymond "
|
|
|
|
|
"Hettinger."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:90
|
|
|
|
|
msgid "PEP 237: Unifying Long Integers and Integers"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:92
|
|
|
|
|
msgid ""
|
|
|
|
|
"The lengthy transition process for this PEP, begun in Python 2.2, takes "
|
|
|
|
|
"another step forward in Python 2.4. In 2.3, certain integer operations that "
|
|
|
|
|
"would behave differently after int/long unification triggered :exc:"
|
|
|
|
|
"`FutureWarning` warnings and returned values limited to 32 or 64 bits "
|
|
|
|
|
"(depending on your platform). In 2.4, these expressions no longer produce a "
|
|
|
|
|
"warning and instead produce a different result that's usually a long integer."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:99
|
|
|
|
|
msgid ""
|
|
|
|
|
"The problematic expressions are primarily left shifts and lengthy "
|
|
|
|
|
"hexadecimal and octal constants. For example, ``2 << 32`` results in a "
|
|
|
|
|
"warning in 2.3, evaluating to 0 on 32-bit platforms. In Python 2.4, this "
|
|
|
|
|
"expression now returns the correct answer, 8589934592."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:108
|
|
|
|
|
msgid ":pep:`237` - Unifying Long Integers and Integers"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:108
|
|
|
|
|
msgid ""
|
|
|
|
|
"Original PEP written by Moshe Zadka and GvR. The changes for 2.4 were "
|
|
|
|
|
"implemented by Kalle Svensson."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:115
|
|
|
|
|
msgid "PEP 289: Generator Expressions"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:117
|
|
|
|
|
msgid ""
|
|
|
|
|
"The iterator feature introduced in Python 2.2 and the :mod:`itertools` "
|
|
|
|
|
"module make it easier to write programs that loop through large data sets "
|
|
|
|
|
"without having the entire data set in memory at one time. List "
|
|
|
|
|
"comprehensions don't fit into this picture very well because they produce a "
|
|
|
|
|
"Python list object containing all of the items. This unavoidably pulls all "
|
|
|
|
|
"of the objects into memory, which can be a problem if your data set is very "
|
|
|
|
|
"large. When trying to write a functionally-styled program, it would be "
|
|
|
|
|
"natural to write something like::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:129
|
|
|
|
|
msgid "instead of ::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:136
|
|
|
|
|
msgid ""
|
|
|
|
|
"The first form is more concise and perhaps more readable, but if you're "
|
|
|
|
|
"dealing with a large number of link objects you'd have to write the second "
|
|
|
|
|
"form to avoid having all link objects in memory at the same time."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:140
|
|
|
|
|
msgid ""
|
|
|
|
|
"Generator expressions work similarly to list comprehensions but don't "
|
|
|
|
|
"materialize the entire list; instead they create a generator that will "
|
|
|
|
|
"return elements one by one. The above example could be written as::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:148
|
|
|
|
|
msgid ""
|
|
|
|
|
"Generator expressions always have to be written inside parentheses, as in "
|
|
|
|
|
"the above example. The parentheses signalling a function call also count, "
|
|
|
|
|
"so if you want to create an iterator that will be immediately passed to a "
|
|
|
|
|
"function you could write::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:155
|
|
|
|
|
msgid ""
|
|
|
|
|
"Generator expressions differ from list comprehensions in various small ways. "
|
|
|
|
|
"Most notably, the loop variable (*obj* in the above example) is not "
|
|
|
|
|
"accessible outside of the generator expression. List comprehensions leave "
|
|
|
|
|
"the variable assigned to its last value; future versions of Python will "
|
|
|
|
|
"change this, making list comprehensions match generator expressions in this "
|
|
|
|
|
"respect."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:165
|
|
|
|
|
msgid ":pep:`289` - Generator Expressions"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:165
|
|
|
|
|
msgid ""
|
|
|
|
|
"Proposed by Raymond Hettinger and implemented by Jiwon Seo with early "
|
|
|
|
|
"efforts steered by Hye-Shik Chang."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:172
|
|
|
|
|
msgid "PEP 292: Simpler String Substitutions"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:174
|
|
|
|
|
msgid ""
|
|
|
|
|
"Some new classes in the standard library provide an alternative mechanism "
|
|
|
|
|
"for substituting variables into strings; this style of substitution may be "
|
|
|
|
|
"better for applications where untrained users need to edit templates."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:178
|
|
|
|
|
msgid "The usual way of substituting variables by name is the ``%`` operator::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:183
|
|
|
|
|
msgid ""
|
|
|
|
|
"When writing the template string, it can be easy to forget the ``i`` or "
|
|
|
|
|
"``s`` after the closing parenthesis. This isn't a big problem if the "
|
|
|
|
|
"template is in a Python module, because you run the code, get an "
|
|
|
|
|
"\"Unsupported format character\" :exc:`ValueError`, and fix the problem. "
|
|
|
|
|
"However, consider an application such as Mailman where template strings or "
|
|
|
|
|
"translations are being edited by users who aren't aware of the Python "
|
|
|
|
|
"language. The format string's syntax is complicated to explain to such "
|
|
|
|
|
"users, and if they make a mistake, it's difficult to provide helpful "
|
|
|
|
|
"feedback to them."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:192
|
|
|
|
|
msgid ""
|
|
|
|
|
"PEP 292 adds a :class:`Template` class to the :mod:`string` module that uses "
|
|
|
|
|
"``$`` to indicate a substitution::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:200
|
|
|
|
|
msgid ""
|
|
|
|
|
"If a key is missing from the dictionary, the :meth:`substitute` method will "
|
|
|
|
|
"raise a :exc:`KeyError`. There's also a :meth:`safe_substitute` method that "
|
|
|
|
|
"ignores missing keys::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:211
|
|
|
|
|
msgid ":pep:`292` - Simpler String Substitutions"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:212
|
|
|
|
|
msgid "Written and implemented by Barry Warsaw."
|
|
|
|
|
msgstr "Écrit et implémenté par Barry Warsaw."
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:218
|
|
|
|
|
msgid "PEP 318: Decorators for Functions and Methods"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:220
|
|
|
|
|
msgid ""
|
|
|
|
|
"Python 2.2 extended Python's object model by adding static methods and class "
|
|
|
|
|
"methods, but it didn't extend Python's syntax to provide any new way of "
|
|
|
|
|
"defining static or class methods. Instead, you had to write a :keyword:"
|
|
|
|
|
"`def` statement in the usual way, and pass the resulting method to a :func:"
|
|
|
|
|
"`staticmethod` or :func:`classmethod` function that would wrap up the "
|
|
|
|
|
"function as a method of the new type. Your code would look like this::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:233
|
|
|
|
|
msgid ""
|
|
|
|
|
"If the method was very long, it would be easy to miss or forget the :func:"
|
|
|
|
|
"`classmethod` invocation after the function body."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:236
|
|
|
|
|
msgid ""
|
|
|
|
|
"The intention was always to add some syntax to make such definitions more "
|
|
|
|
|
"readable, but at the time of 2.2's release a good syntax was not obvious. "
|
|
|
|
|
"Today a good syntax *still* isn't obvious but users are asking for easier "
|
|
|
|
|
"access to the feature; a new syntactic feature has been added to meet this "
|
|
|
|
|
"need."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:241
|
|
|
|
|
msgid ""
|
|
|
|
|
"The new feature is called \"function decorators\". The name comes from the "
|
|
|
|
|
"idea that :func:`classmethod`, :func:`staticmethod`, and friends are storing "
|
|
|
|
|
"additional information on a function object; they're *decorating* functions "
|
|
|
|
|
"with more details."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:246
|
|
|
|
|
msgid ""
|
|
|
|
|
"The notation borrows from Java and uses the ``'@'`` character as an "
|
|
|
|
|
"indicator. Using the new syntax, the example above would be written::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:256
|
|
|
|
|
msgid ""
|
|
|
|
|
"The ``@classmethod`` is shorthand for the ``meth=classmethod(meth)`` "
|
|
|
|
|
"assignment. More generally, if you have the following::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:265
|
|
|
|
|
msgid "It's equivalent to the following pre-decorator code::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:270
|
|
|
|
|
msgid ""
|
|
|
|
|
"Decorators must come on the line before a function definition, one decorator "
|
|
|
|
|
"per line, and can't be on the same line as the def statement, meaning that "
|
|
|
|
|
"``@A def f(): ...`` is illegal. You can only decorate function definitions, "
|
|
|
|
|
"either at the module level or inside a class; you can't decorate class "
|
|
|
|
|
"definitions."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:275
|
|
|
|
|
msgid ""
|
|
|
|
|
"A decorator is just a function that takes the function to be decorated as an "
|
|
|
|
|
"argument and returns either the same function or some new object. The "
|
|
|
|
|
"return value of the decorator need not be callable (though it typically is), "
|
|
|
|
|
"unless further decorators will be applied to the result. It's easy to write "
|
|
|
|
|
"your own decorators. The following simple example just sets an attribute on "
|
|
|
|
|
"the function object::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:295
|
|
|
|
|
msgid ""
|
|
|
|
|
"As a slightly more realistic example, the following decorator checks that "
|
|
|
|
|
"the supplied argument is an integer::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:313
|
|
|
|
|
msgid ""
|
|
|
|
|
"An example in :pep:`318` contains a fancier version of this idea that lets "
|
|
|
|
|
"you both specify the required type and check the returned type."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:316
|
|
|
|
|
msgid ""
|
|
|
|
|
"Decorator functions can take arguments. If arguments are supplied, your "
|
|
|
|
|
"decorator function is called with only those arguments and must return a new "
|
|
|
|
|
"decorator function; this function must take a single function and return a "
|
|
|
|
|
"function, as previously described. In other words, ``@A @B @C(args)`` "
|
|
|
|
|
"becomes::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:325
|
|
|
|
|
msgid ""
|
|
|
|
|
"Getting this right can be slightly brain-bending, but it's not too difficult."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:327
|
|
|
|
|
msgid ""
|
|
|
|
|
"A small related change makes the :attr:`func_name` attribute of functions "
|
|
|
|
|
"writable. This attribute is used to display function names in tracebacks, "
|
|
|
|
|
"so decorators should change the name of any new function that's constructed "
|
|
|
|
|
"and returned."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:338
|
|
|
|
|
msgid ":pep:`318` - Decorators for Functions, Methods and Classes"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:336
|
|
|
|
|
msgid ""
|
|
|
|
|
"Written by Kevin D. Smith, Jim Jewett, and Skip Montanaro. Several people "
|
|
|
|
|
"wrote patches implementing function decorators, but the one that was "
|
|
|
|
|
"actually checked in was patch #979728, written by Mark Russell."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:340
|
|
|
|
|
msgid "https://wiki.python.org/moin/PythonDecoratorLibrary"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:341
|
|
|
|
|
msgid "This Wiki page contains several examples of decorators."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:347
|
|
|
|
|
msgid "PEP 322: Reverse Iteration"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:349
|
|
|
|
|
msgid ""
|
|
|
|
|
"A new built-in function, ``reversed(seq)``, takes a sequence and returns an "
|
|
|
|
|
"iterator that loops over the elements of the sequence in reverse order. ::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:359
|
|
|
|
|
msgid ""
|
|
|
|
|
"Compared to extended slicing, such as ``range(1,4)[::-1]``, :func:`reversed` "
|
|
|
|
|
"is easier to read, runs faster, and uses substantially less memory."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:362
|
|
|
|
|
msgid ""
|
|
|
|
|
"Note that :func:`reversed` only accepts sequences, not arbitrary iterators. "
|
|
|
|
|
"If you want to reverse an iterator, first convert it to a list with :func:"
|
|
|
|
|
"`list`. ::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:376
|
|
|
|
|
msgid ":pep:`322` - Reverse Iteration"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:377
|
|
|
|
|
msgid "Written and implemented by Raymond Hettinger."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:383
|
|
|
|
|
msgid "PEP 324: New subprocess Module"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:385
|
|
|
|
|
msgid ""
|
|
|
|
|
"The standard library provides a number of ways to execute a subprocess, "
|
|
|
|
|
"offering different features and different levels of complexity. ``os."
|
|
|
|
|
"system(command)`` is easy to use, but slow (it runs a shell process which "
|
|
|
|
|
"executes the command) and dangerous (you have to be careful about escaping "
|
|
|
|
|
"the shell's metacharacters). The :mod:`popen2` module offers classes that "
|
|
|
|
|
"can capture standard output and standard error from the subprocess, but the "
|
|
|
|
|
"naming is confusing. The :mod:`subprocess` module cleans this up, "
|
|
|
|
|
"providing a unified interface that offers all the features you might need."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:394
|
|
|
|
|
msgid ""
|
|
|
|
|
"Instead of :mod:`popen2`'s collection of classes, :mod:`subprocess` contains "
|
|
|
|
|
"a single class called :class:`Popen` whose constructor supports a number of "
|
|
|
|
|
"different keyword arguments. ::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:404
|
|
|
|
|
msgid ""
|
|
|
|
|
"*args* is commonly a sequence of strings that will be the arguments to the "
|
|
|
|
|
"program executed as the subprocess. (If the *shell* argument is true, "
|
|
|
|
|
"*args* can be a string which will then be passed on to the shell for "
|
|
|
|
|
"interpretation, just as :func:`os.system` does.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:409
|
|
|
|
|
msgid ""
|
|
|
|
|
"*stdin*, *stdout*, and *stderr* specify what the subprocess's input, output, "
|
|
|
|
|
"and error streams will be. You can provide a file object or a file "
|
|
|
|
|
"descriptor, or you can use the constant ``subprocess.PIPE`` to create a pipe "
|
|
|
|
|
"between the subprocess and the parent."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:417
|
|
|
|
|
msgid "The constructor has a number of handy options:"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:419
|
|
|
|
|
msgid ""
|
|
|
|
|
"*close_fds* requests that all file descriptors be closed before running the "
|
|
|
|
|
"subprocess."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:422
|
|
|
|
|
msgid ""
|
|
|
|
|
"*cwd* specifies the working directory in which the subprocess will be "
|
|
|
|
|
"executed (defaulting to whatever the parent's working directory is)."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:425
|
|
|
|
|
msgid "*env* is a dictionary specifying environment variables."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:427
|
|
|
|
|
msgid ""
|
|
|
|
|
"*preexec_fn* is a function that gets called before the child is started."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:429
|
|
|
|
|
msgid ""
|
|
|
|
|
"*universal_newlines* opens the child's input and output using Python's :term:"
|
|
|
|
|
"`universal newlines` feature."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:432
|
|
|
|
|
msgid ""
|
|
|
|
|
"Once you've created the :class:`Popen` instance, you can call its :meth:"
|
|
|
|
|
"`wait` method to pause until the subprocess has exited, :meth:`poll` to "
|
|
|
|
|
"check if it's exited without pausing, or ``communicate(data)`` to send the "
|
|
|
|
|
"string *data* to the subprocess's standard input. ``communicate(data)`` "
|
|
|
|
|
"then reads any data that the subprocess has sent to its standard output or "
|
|
|
|
|
"standard error, returning a tuple ``(stdout_data, stderr_data)``."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:439
|
|
|
|
|
msgid ""
|
|
|
|
|
":func:`call` is a shortcut that passes its arguments along to the :class:"
|
|
|
|
|
"`Popen` constructor, waits for the command to complete, and returns the "
|
|
|
|
|
"status code of the subprocess. It can serve as a safer analog to :func:`os."
|
|
|
|
|
"system`::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:451
|
|
|
|
|
msgid ""
|
|
|
|
|
"The command is invoked without use of the shell. If you really do want to "
|
|
|
|
|
"use the shell, you can add ``shell=True`` as a keyword argument and provide "
|
|
|
|
|
"a string instead of a sequence::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:457
|
|
|
|
|
msgid ""
|
|
|
|
|
"The PEP takes various examples of shell and Python code and shows how they'd "
|
|
|
|
|
"be translated into Python code that uses :mod:`subprocess`. Reading this "
|
|
|
|
|
"section of the PEP is highly recommended."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:465
|
|
|
|
|
msgid ":pep:`324` - subprocess - New process module"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:465
|
|
|
|
|
msgid ""
|
|
|
|
|
"Written and implemented by Peter Åstrand, with assistance from Fredrik Lundh "
|
|
|
|
|
"and others."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:472
|
|
|
|
|
msgid "PEP 327: Decimal Data Type"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:474
|
|
|
|
|
msgid ""
|
|
|
|
|
"Python has always supported floating-point (FP) numbers, based on the "
|
|
|
|
|
"underlying C :c:type:`double` type, as a data type. However, while most "
|
|
|
|
|
"programming languages provide a floating-point type, many people (even "
|
|
|
|
|
"programmers) are unaware that floating-point numbers don't represent certain "
|
|
|
|
|
"decimal fractions accurately. The new :class:`Decimal` type can represent "
|
|
|
|
|
"these fractions accurately, up to a user-specified precision limit."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:483
|
|
|
|
|
msgid "Why is Decimal needed?"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:485
|
|
|
|
|
msgid ""
|
|
|
|
|
"The limitations arise from the representation used for floating-point "
|
|
|
|
|
"numbers. FP numbers are made up of three components:"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:488
|
|
|
|
|
msgid "The sign, which is positive or negative."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:490
|
|
|
|
|
msgid ""
|
|
|
|
|
"The mantissa, which is a single-digit binary number followed by a "
|
|
|
|
|
"fractional part. For example, ``1.01`` in base-2 notation is ``1 + 0/2 + "
|
|
|
|
|
"1/4``, or 1.25 in decimal notation."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:494
|
|
|
|
|
msgid ""
|
|
|
|
|
"The exponent, which tells where the decimal point is located in the number "
|
|
|
|
|
"represented."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:497
|
|
|
|
|
msgid ""
|
|
|
|
|
"For example, the number 1.25 has positive sign, a mantissa value of 1.01 (in "
|
|
|
|
|
"binary), and an exponent of 0 (the decimal point doesn't need to be "
|
|
|
|
|
"shifted). The number 5 has the same sign and mantissa, but the exponent is 2 "
|
|
|
|
|
"because the mantissa is multiplied by 4 (2 to the power of the exponent 2); "
|
|
|
|
|
"1.25 \\* 4 equals 5."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:503
|
|
|
|
|
msgid ""
|
|
|
|
|
"Modern systems usually provide floating-point support that conforms to a "
|
|
|
|
|
"standard called IEEE 754. C's :c:type:`double` type is usually implemented "
|
|
|
|
|
"as a 64-bit IEEE 754 number, which uses 52 bits of space for the mantissa. "
|
|
|
|
|
"This means that numbers can only be specified to 52 bits of precision. If "
|
|
|
|
|
"you're trying to represent numbers whose expansion repeats endlessly, the "
|
|
|
|
|
"expansion is cut off after 52 bits. Unfortunately, most software needs to "
|
|
|
|
|
"produce output in base 10, and common fractions in base 10 are often "
|
|
|
|
|
"repeating decimals in binary. For example, 1.1 decimal is binary "
|
|
|
|
|
"``1.0001100110011 ...``; .1 = 1/16 + 1/32 + 1/256 plus an infinite number of "
|
|
|
|
|
"additional terms. IEEE 754 has to chop off that infinitely repeated decimal "
|
|
|
|
|
"after 52 digits, so the representation is slightly inaccurate."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:515
|
|
|
|
|
msgid "Sometimes you can see this inaccuracy when the number is printed::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:520
|
|
|
|
|
msgid ""
|
|
|
|
|
"The inaccuracy isn't always visible when you print the number because the FP-"
|
2017-04-02 20:14:06 +00:00
|
|
|
|
"to-decimal-string conversion is provided by the C library, and most C "
|
2016-10-30 09:46:26 +00:00
|
|
|
|
"libraries try to produce sensible output. Even if it's not displayed, "
|
|
|
|
|
"however, the inaccuracy is still there and subsequent operations can magnify "
|
|
|
|
|
"the error."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:525
|
|
|
|
|
msgid ""
|
|
|
|
|
"For many applications this doesn't matter. If I'm plotting points and "
|
|
|
|
|
"displaying them on my monitor, the difference between 1.1 and "
|
|
|
|
|
"1.1000000000000001 is too small to be visible. Reports often limit output "
|
|
|
|
|
"to a certain number of decimal places, and if you round the number to two or "
|
|
|
|
|
"three or even eight decimal places, the error is never apparent. However, "
|
|
|
|
|
"for applications where it does matter, it's a lot of work to implement your "
|
|
|
|
|
"own custom arithmetic routines."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:533
|
|
|
|
|
msgid "Hence, the :class:`Decimal` type was created."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:537
|
|
|
|
|
msgid "The :class:`Decimal` type"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:539
|
|
|
|
|
msgid ""
|
|
|
|
|
"A new module, :mod:`decimal`, was added to Python's standard library. It "
|
|
|
|
|
"contains two classes, :class:`Decimal` and :class:`Context`. :class:"
|
|
|
|
|
"`Decimal` instances represent numbers, and :class:`Context` instances are "
|
|
|
|
|
"used to wrap up various settings such as the precision and default rounding "
|
|
|
|
|
"mode."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:544
|
|
|
|
|
msgid ""
|
|
|
|
|
":class:`Decimal` instances are immutable, like regular Python integers and "
|
|
|
|
|
"FP numbers; once it's been created, you can't change the value an instance "
|
|
|
|
|
"represents. :class:`Decimal` instances can be created from integers or "
|
|
|
|
|
"strings::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:555
|
|
|
|
|
msgid ""
|
|
|
|
|
"You can also provide tuples containing the sign, the mantissa represented "
|
|
|
|
|
"as a tuple of decimal digits, and the exponent::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:561
|
|
|
|
|
msgid ""
|
|
|
|
|
"Cautionary note: the sign bit is a Boolean value, so 0 is positive and 1 is "
|
|
|
|
|
"negative."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:564
|
|
|
|
|
msgid ""
|
|
|
|
|
"Converting from floating-point numbers poses a bit of a problem: should the "
|
|
|
|
|
"FP number representing 1.1 turn into the decimal number for exactly 1.1, or "
|
|
|
|
|
"for 1.1 plus whatever inaccuracies are introduced? The decision was to dodge "
|
|
|
|
|
"the issue and leave such a conversion out of the API. Instead, you should "
|
|
|
|
|
"convert the floating-point number into a string using the desired precision "
|
|
|
|
|
"and pass the string to the :class:`Decimal` constructor::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:577
|
|
|
|
|
msgid ""
|
|
|
|
|
"Once you have :class:`Decimal` instances, you can perform the usual "
|
|
|
|
|
"mathematical operations on them. One limitation: exponentiation requires an "
|
|
|
|
|
"integer exponent::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:598
|
|
|
|
|
msgid ""
|
|
|
|
|
"You can combine :class:`Decimal` instances with integers, but not with "
|
2017-04-02 20:14:06 +00:00
|
|
|
|
"floating-point numbers::"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:609
|
|
|
|
|
msgid ""
|
|
|
|
|
":class:`Decimal` numbers can be used with the :mod:`math` and :mod:`cmath` "
|
|
|
|
|
"modules, but note that they'll be immediately converted to floating-point "
|
|
|
|
|
"numbers before the operation is performed, resulting in a possible loss of "
|
|
|
|
|
"precision and accuracy. You'll also get back a regular floating-point "
|
|
|
|
|
"number and not a :class:`Decimal`. ::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:622
|
|
|
|
|
msgid ""
|
|
|
|
|
":class:`Decimal` instances have a :meth:`sqrt` method that returns a :class:"
|
|
|
|
|
"`Decimal`, but if you need other things such as trigonometric functions "
|
|
|
|
|
"you'll have to implement them. ::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:631
|
|
|
|
|
msgid "The :class:`Context` type"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:633
|
|
|
|
|
msgid ""
|
|
|
|
|
"Instances of the :class:`Context` class encapsulate several settings for "
|
|
|
|
|
"decimal operations:"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:636
|
|
|
|
|
msgid ":attr:`prec` is the precision, the number of decimal places."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:638
|
|
|
|
|
msgid ""
|
|
|
|
|
":attr:`rounding` specifies the rounding mode. The :mod:`decimal` module has "
|
|
|
|
|
"constants for the various possibilities: :const:`ROUND_DOWN`, :const:"
|
|
|
|
|
"`ROUND_CEILING`, :const:`ROUND_HALF_EVEN`, and various others."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:642
|
|
|
|
|
msgid ""
|
|
|
|
|
":attr:`traps` is a dictionary specifying what happens on encountering "
|
|
|
|
|
"certain error conditions: either an exception is raised or a value is "
|
|
|
|
|
"returned. Some examples of error conditions are division by zero, loss of "
|
|
|
|
|
"precision, and overflow."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:647
|
|
|
|
|
msgid ""
|
|
|
|
|
"There's a thread-local default context available by calling :func:"
|
|
|
|
|
"`getcontext`; you can change the properties of this context to alter the "
|
|
|
|
|
"default precision, rounding, or trap handling. The following example shows "
|
|
|
|
|
"the effect of changing the precision of the default context::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:660
|
|
|
|
|
msgid ""
|
|
|
|
|
"The default action for error conditions is selectable; the module can either "
|
|
|
|
|
"return a special value such as infinity or not-a-number, or exceptions can "
|
|
|
|
|
"be raised::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:673
|
|
|
|
|
msgid ""
|
|
|
|
|
"The :class:`Context` instance also has various methods for formatting "
|
|
|
|
|
"numbers such as :meth:`to_eng_string` and :meth:`to_sci_string`."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:676
|
|
|
|
|
msgid ""
|
|
|
|
|
"For more information, see the documentation for the :mod:`decimal` module, "
|
|
|
|
|
"which includes a quick-start tutorial and a reference."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:684
|
|
|
|
|
msgid ":pep:`327` - Decimal Data Type"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:683
|
|
|
|
|
msgid ""
|
|
|
|
|
"Written by Facundo Batista and implemented by Facundo Batista, Eric Price, "
|
|
|
|
|
"Raymond Hettinger, Aahz, and Tim Peters."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:688
|
|
|
|
|
msgid "http://www.lahey.com/float.htm"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:687
|
|
|
|
|
msgid ""
|
|
|
|
|
"The article uses Fortran code to illustrate many of the problems that "
|
2017-04-02 20:14:06 +00:00
|
|
|
|
"floating-point inaccuracy can cause."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:692
|
|
|
|
|
msgid "http://speleotrove.com/decimal/"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:691
|
|
|
|
|
msgid ""
|
|
|
|
|
"A description of a decimal-based representation. This representation is "
|
|
|
|
|
"being proposed as a standard, and underlies the new Python decimal type. "
|
|
|
|
|
"Much of this material was written by Mike Cowlishaw, designer of the Rexx "
|
|
|
|
|
"language."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:699
|
|
|
|
|
msgid "PEP 328: Multi-line Imports"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:701
|
|
|
|
|
msgid ""
|
|
|
|
|
"One language change is a small syntactic tweak aimed at making it easier to "
|
|
|
|
|
"import many names from a module. In a ``from module import names`` "
|
|
|
|
|
"statement, *names* is a sequence of names separated by commas. If the "
|
|
|
|
|
"sequence is very long, you can either write multiple imports from the same "
|
|
|
|
|
"module, or you can use backslashes to escape the line endings like this::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:712
|
|
|
|
|
msgid ""
|
|
|
|
|
"The syntactic change in Python 2.4 simply allows putting the names within "
|
|
|
|
|
"parentheses. Python ignores newlines within a parenthesized expression, so "
|
|
|
|
|
"the backslashes are no longer needed::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:721
|
|
|
|
|
msgid ""
|
|
|
|
|
"The PEP also proposes that all :keyword:`import` statements be absolute "
|
|
|
|
|
"imports, with a leading ``.`` character to indicate a relative import. This "
|
|
|
|
|
"part of the PEP was not implemented for Python 2.4, but was completed for "
|
|
|
|
|
"Python 2.5."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:728
|
|
|
|
|
msgid ":pep:`328` - Imports: Multi-Line and Absolute/Relative"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:729
|
|
|
|
|
msgid "Written by Aahz. Multi-line imports were implemented by Dima Dorfman."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:735
|
|
|
|
|
msgid "PEP 331: Locale-Independent Float/String Conversions"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:737
|
|
|
|
|
msgid ""
|
|
|
|
|
"The :mod:`locale` modules lets Python software select various conversions "
|
|
|
|
|
"and display conventions that are localized to a particular country or "
|
|
|
|
|
"language. However, the module was careful to not change the numeric locale "
|
|
|
|
|
"because various functions in Python's implementation required that the "
|
|
|
|
|
"numeric locale remain set to the ``'C'`` locale. Often this was because the "
|
|
|
|
|
"code was using the C library's :c:func:`atof` function."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:744
|
|
|
|
|
msgid ""
|
2017-04-02 20:14:06 +00:00
|
|
|
|
"Not setting the numeric locale caused trouble for extensions that used third-"
|
|
|
|
|
"party C libraries, however, because they wouldn't have the correct locale "
|
|
|
|
|
"set. The motivating example was GTK+, whose user interface widgets weren't "
|
|
|
|
|
"displaying numbers in the current locale."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:749
|
|
|
|
|
msgid ""
|
|
|
|
|
"The solution described in the PEP is to add three new functions to the "
|
|
|
|
|
"Python API that perform ASCII-only conversions, ignoring the locale setting:"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:752
|
|
|
|
|
msgid ""
|
|
|
|
|
"``PyOS_ascii_strtod(str, ptr)`` and ``PyOS_ascii_atof(str, ptr)`` both "
|
|
|
|
|
"convert a string to a C :c:type:`double`."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:755
|
|
|
|
|
msgid ""
|
|
|
|
|
"``PyOS_ascii_formatd(buffer, buf_len, format, d)`` converts a :c:type:"
|
|
|
|
|
"`double` to an ASCII string."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:758
|
|
|
|
|
msgid ""
|
|
|
|
|
"The code for these functions came from the GLib library (https://developer."
|
|
|
|
|
"gnome.org/glib/stable/), whose developers kindly relicensed the relevant "
|
|
|
|
|
"functions and donated them to the Python Software Foundation. The :mod:"
|
|
|
|
|
"`locale` module can now change the numeric locale, letting extensions such "
|
|
|
|
|
"as GTK+ produce the correct results."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:767
|
|
|
|
|
msgid ":pep:`331` - Locale-Independent Float/String Conversions"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:768
|
|
|
|
|
msgid "Written by Christian R. Reis, and implemented by Gustavo Carneiro."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:774
|
|
|
|
|
msgid "Other Language Changes"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:776
|
|
|
|
|
msgid ""
|
|
|
|
|
"Here are all of the changes that Python 2.4 makes to the core Python "
|
|
|
|
|
"language."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:778
|
|
|
|
|
msgid "Decorators for functions and methods were added (:pep:`318`)."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:780
|
|
|
|
|
msgid ""
|
|
|
|
|
"Built-in :func:`set` and :func:`frozenset` types were added (:pep:`218`). "
|
|
|
|
|
"Other new built-ins include the ``reversed(seq)`` function (:pep:`322`)."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:783
|
|
|
|
|
msgid "Generator expressions were added (:pep:`289`)."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:785
|
|
|
|
|
msgid ""
|
|
|
|
|
"Certain numeric expressions no longer return values restricted to 32 or 64 "
|
|
|
|
|
"bits (:pep:`237`)."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:788
|
|
|
|
|
msgid ""
|
|
|
|
|
"You can now put parentheses around the list of names in a ``from module "
|
|
|
|
|
"import names`` statement (:pep:`328`)."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:791
|
|
|
|
|
msgid ""
|
|
|
|
|
"The :meth:`dict.update` method now accepts the same argument forms as the :"
|
|
|
|
|
"class:`dict` constructor. This includes any mapping, any iterable of key/"
|
|
|
|
|
"value pairs, and keyword arguments. (Contributed by Raymond Hettinger.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:795
|
|
|
|
|
msgid ""
|
|
|
|
|
"The string methods :meth:`ljust`, :meth:`rjust`, and :meth:`center` now take "
|
|
|
|
|
"an optional argument for specifying a fill character other than a space. "
|
|
|
|
|
"(Contributed by Raymond Hettinger.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:799
|
|
|
|
|
msgid ""
|
|
|
|
|
"Strings also gained an :meth:`rsplit` method that works like the :meth:"
|
|
|
|
|
"`split` method but splits from the end of the string. (Contributed by Sean "
|
|
|
|
|
"Reifschneider.) ::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:808
|
|
|
|
|
msgid ""
|
|
|
|
|
"Three keyword parameters, *cmp*, *key*, and *reverse*, were added to the :"
|
|
|
|
|
"meth:`sort` method of lists. These parameters make some common usages of :"
|
|
|
|
|
"meth:`sort` simpler. All of these parameters are optional."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:812
|
|
|
|
|
msgid ""
|
|
|
|
|
"For the *cmp* parameter, the value should be a comparison function that "
|
|
|
|
|
"takes two parameters and returns -1, 0, or +1 depending on how the "
|
|
|
|
|
"parameters compare. This function will then be used to sort the list. "
|
|
|
|
|
"Previously this was the only parameter that could be provided to :meth:"
|
|
|
|
|
"`sort`."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:817
|
|
|
|
|
msgid ""
|
|
|
|
|
"*key* should be a single-parameter function that takes a list element and "
|
|
|
|
|
"returns a comparison key for the element. The list is then sorted using the "
|
|
|
|
|
"comparison keys. The following example sorts a list case-insensitively::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:834
|
|
|
|
|
msgid ""
|
|
|
|
|
"The last example, which uses the *cmp* parameter, is the old way to perform "
|
|
|
|
|
"a case-insensitive sort. It works but is slower than using a *key* "
|
|
|
|
|
"parameter. Using *key* calls :meth:`lower` method once for each element in "
|
|
|
|
|
"the list while using *cmp* will call it twice for each comparison, so using "
|
|
|
|
|
"*key* saves on invocations of the :meth:`lower` method."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:840
|
|
|
|
|
msgid ""
|
|
|
|
|
"For simple key functions and comparison functions, it is often possible to "
|
|
|
|
|
"avoid a :keyword:`lambda` expression by using an unbound method instead. "
|
|
|
|
|
"For example, the above case-insensitive sort is best written as::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:848
|
|
|
|
|
msgid ""
|
|
|
|
|
"Finally, the *reverse* parameter takes a Boolean value. If the value is "
|
|
|
|
|
"true, the list will be sorted into reverse order. Instead of ``L.sort(); L."
|
|
|
|
|
"reverse()``, you can now write ``L.sort(reverse=True)``."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:852
|
|
|
|
|
msgid ""
|
|
|
|
|
"The results of sorting are now guaranteed to be stable. This means that two "
|
|
|
|
|
"entries with equal keys will be returned in the same order as they were "
|
|
|
|
|
"input. For example, you can sort a list of people by name, and then sort the "
|
|
|
|
|
"list by age, resulting in a list sorted by age where people with the same "
|
|
|
|
|
"age are in name-sorted order."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:858
|
|
|
|
|
msgid "(All changes to :meth:`sort` contributed by Raymond Hettinger.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:860
|
|
|
|
|
msgid ""
|
|
|
|
|
"There is a new built-in function ``sorted(iterable)`` that works like the in-"
|
|
|
|
|
"place :meth:`list.sort` method but can be used in expressions. The "
|
|
|
|
|
"differences are:"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:864
|
|
|
|
|
msgid "the input may be any iterable;"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:866
|
|
|
|
|
msgid "a newly formed copy is sorted, leaving the original intact; and"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:868
|
|
|
|
|
msgid "the expression returns the new sorted copy"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:891 ../Doc/whatsnew/2.4.rst:919
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1212
|
|
|
|
|
msgid "(Contributed by Raymond Hettinger.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:893 ../Doc/whatsnew/2.4.rst:1519
|
|
|
|
|
msgid ""
|
|
|
|
|
"Integer operations will no longer trigger an :exc:`OverflowWarning`. The :"
|
|
|
|
|
"exc:`OverflowWarning` warning will disappear in Python 2.5."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:896
|
|
|
|
|
msgid ""
|
|
|
|
|
"The interpreter gained a new switch, :option:`-m`, that takes a name, "
|
|
|
|
|
"searches for the corresponding module on ``sys.path``, and runs the module "
|
|
|
|
|
"as a script. For example, you can now run the Python profiler with ``python "
|
|
|
|
|
"-m profile``. (Contributed by Nick Coghlan.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:901
|
|
|
|
|
msgid ""
|
|
|
|
|
"The ``eval(expr, globals, locals)`` and ``execfile(filename, globals, "
|
|
|
|
|
"locals)`` functions and the ``exec`` statement now accept any mapping type "
|
|
|
|
|
"for the *locals* parameter. Previously this had to be a regular Python "
|
|
|
|
|
"dictionary. (Contributed by Raymond Hettinger.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:906
|
|
|
|
|
msgid ""
|
|
|
|
|
"The :func:`zip` built-in function and :func:`itertools.izip` now return an "
|
|
|
|
|
"empty list if called with no arguments. Previously they raised a :exc:"
|
|
|
|
|
"`TypeError` exception. This makes them more suitable for use with variable "
|
|
|
|
|
"length argument lists::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:921
|
|
|
|
|
msgid ""
|
2017-04-02 20:14:06 +00:00
|
|
|
|
"Encountering a failure while importing a module no longer leaves a partially-"
|
|
|
|
|
"initialized module object in ``sys.modules``. The incomplete module object "
|
|
|
|
|
"left behind would fool further imports of the same module into succeeding, "
|
|
|
|
|
"leading to confusing errors. (Fixed by Tim Peters.)"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:926
|
|
|
|
|
msgid ""
|
|
|
|
|
":const:`None` is now a constant; code that binds a new value to the name "
|
|
|
|
|
"``None`` is now a syntax error. (Contributed by Raymond Hettinger.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:933
|
|
|
|
|
msgid "Optimizations"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:935
|
|
|
|
|
msgid ""
|
|
|
|
|
"The inner loops for list and tuple slicing were optimized and now run about "
|
|
|
|
|
"one-third faster. The inner loops for dictionaries were also optimized, "
|
|
|
|
|
"resulting in performance boosts for :meth:`keys`, :meth:`values`, :meth:"
|
|
|
|
|
"`items`, :meth:`iterkeys`, :meth:`itervalues`, and :meth:`iteritems`. "
|
|
|
|
|
"(Contributed by Raymond Hettinger.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:941
|
|
|
|
|
msgid ""
|
|
|
|
|
"The machinery for growing and shrinking lists was optimized for speed and "
|
|
|
|
|
"for space efficiency. Appending and popping from lists now runs faster due "
|
|
|
|
|
"to more efficient code paths and less frequent use of the underlying system :"
|
|
|
|
|
"c:func:`realloc`. List comprehensions also benefit. :meth:`list.extend` "
|
|
|
|
|
"was also optimized and no longer converts its argument into a temporary list "
|
|
|
|
|
"before extending the base list. (Contributed by Raymond Hettinger.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:948
|
|
|
|
|
msgid ""
|
|
|
|
|
":func:`list`, :func:`tuple`, :func:`map`, :func:`filter`, and :func:`zip` "
|
|
|
|
|
"now run several times faster with non-sequence arguments that supply a :meth:"
|
|
|
|
|
"`__len__` method. (Contributed by Raymond Hettinger.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:952
|
|
|
|
|
msgid ""
|
|
|
|
|
"The methods :meth:`list.__getitem__`, :meth:`dict.__getitem__`, and :meth:"
|
|
|
|
|
"`dict.__contains__` are now implemented as :class:`method_descriptor` "
|
|
|
|
|
"objects rather than :class:`wrapper_descriptor` objects. This form of "
|
|
|
|
|
"access doubles their performance and makes them more suitable for use as "
|
|
|
|
|
"arguments to functionals: ``map(mydict.__getitem__, keylist)``. (Contributed "
|
|
|
|
|
"by Raymond Hettinger.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:959
|
|
|
|
|
msgid ""
|
|
|
|
|
"Added a new opcode, ``LIST_APPEND``, that simplifies the generated bytecode "
|
|
|
|
|
"for list comprehensions and speeds them up by about a third. (Contributed "
|
|
|
|
|
"by Raymond Hettinger.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:963
|
|
|
|
|
msgid ""
|
|
|
|
|
"The peephole bytecode optimizer has been improved to produce shorter, "
|
|
|
|
|
"faster bytecode; remarkably, the resulting bytecode is more readable. "
|
|
|
|
|
"(Enhanced by Raymond Hettinger.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:967
|
|
|
|
|
msgid ""
|
|
|
|
|
"String concatenations in statements of the form ``s = s + \"abc\"`` and ``s "
|
|
|
|
|
"+= \"abc\"`` are now performed more efficiently in certain circumstances. "
|
|
|
|
|
"This optimization won't be present in other Python implementations such as "
|
|
|
|
|
"Jython, so you shouldn't rely on it; using the :meth:`join` method of "
|
|
|
|
|
"strings is still recommended when you want to efficiently glue a large "
|
|
|
|
|
"number of strings together. (Contributed by Armin Rigo.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:974
|
|
|
|
|
msgid ""
|
|
|
|
|
"The net result of the 2.4 optimizations is that Python 2.4 runs the pystone "
|
|
|
|
|
"benchmark around 5% faster than Python 2.3 and 35% faster than Python 2.2. "
|
|
|
|
|
"(pystone is not a particularly good benchmark, but it's the most commonly "
|
|
|
|
|
"used measurement of Python's performance. Your own applications may show "
|
|
|
|
|
"greater or smaller benefits from Python 2.4.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:990
|
|
|
|
|
msgid "New, Improved, and Deprecated Modules"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:992
|
|
|
|
|
msgid ""
|
|
|
|
|
"As usual, Python's standard library received a number of enhancements and "
|
|
|
|
|
"bug 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."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:997
|
|
|
|
|
msgid ""
|
|
|
|
|
"The :mod:`asyncore` module's :func:`loop` function now has a *count* "
|
|
|
|
|
"parameter that lets you perform a limited number of passes through the "
|
|
|
|
|
"polling loop. The default is still to loop forever."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1001
|
|
|
|
|
msgid ""
|
2018-06-10 09:32:30 +00:00
|
|
|
|
"The :mod:`base64` module now has more complete :rfc:`3548` support for "
|
|
|
|
|
"Base64, Base32, and Base16 encoding and decoding, including optional case "
|
|
|
|
|
"folding and optional alternative alphabets. (Contributed by Barry Warsaw.)"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1005
|
|
|
|
|
msgid ""
|
|
|
|
|
"The :mod:`bisect` module now has an underlying C implementation for improved "
|
|
|
|
|
"performance. (Contributed by Dmitry Vasiliev.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1008
|
|
|
|
|
msgid ""
|
|
|
|
|
"The CJKCodecs collections of East Asian codecs, maintained by Hye-Shik "
|
|
|
|
|
"Chang, was integrated into 2.4. The new encodings are:"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1011
|
|
|
|
|
msgid "Chinese (PRC): gb2312, gbk, gb18030, big5hkscs, hz"
|
2018-08-03 07:37:42 +00:00
|
|
|
|
msgstr "Chinois (PRC) : *gb2312*, *gbk*, *gb18030*, *big5hkscs*, *hz*"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1013
|
|
|
|
|
msgid "Chinese (ROC): big5, cp950"
|
2018-08-03 07:37:42 +00:00
|
|
|
|
msgstr "Chinois (ROC) : *big5*, *cp950*"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1017
|
|
|
|
|
msgid "Japanese: cp932, euc-jis-2004, euc-jp, euc-jisx0213, iso-2022-jp,"
|
2018-08-03 07:37:42 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
"Japonais : *cp932*, *euc-jis-2004*, *euc-jp*, *euc-jisx0213*, *iso-2022-jp*,"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1016
|
|
|
|
|
msgid ""
|
|
|
|
|
"iso-2022-jp-1, iso-2022-jp-2, iso-2022-jp-3, iso-2022-jp-ext, iso-2022-"
|
|
|
|
|
"jp-2004, shift-jis, shift-jisx0213, shift-jis-2004"
|
|
|
|
|
msgstr ""
|
2018-08-03 07:37:42 +00:00
|
|
|
|
"*iso-2022-jp-1*, *iso-2022-jp-2*, *iso-2022-jp-3*, *iso-2022-jp-ext*, "
|
|
|
|
|
"*iso-2022-jp-2004*, *shift-jis*, *shift-jisx0213*, *shift-jis-2004*"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1019
|
|
|
|
|
msgid "Korean: cp949, euc-kr, johab, iso-2022-kr"
|
2018-08-03 07:37:42 +00:00
|
|
|
|
msgstr "Coréen : *cp949*, *euc-kr*, *johab*, *iso-2022-kr*"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1021
|
|
|
|
|
msgid ""
|
|
|
|
|
"Some other new encodings were added: HP Roman8, ISO_8859-11, ISO_8859-16, "
|
|
|
|
|
"PCTP-154, and TIS-620."
|
|
|
|
|
msgstr ""
|
|
|
|
|
"D’autres encodages ont été ajoutés : HP Roman8, ISO_8859-11, ISO_8859-16, "
|
2018-08-03 07:37:42 +00:00
|
|
|
|
"PCTP-154, et TIS-620."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1024
|
|
|
|
|
msgid ""
|
|
|
|
|
"The UTF-8 and UTF-16 codecs now cope better with receiving partial input. "
|
|
|
|
|
"Previously the :class:`StreamReader` class would try to read more data, "
|
|
|
|
|
"making it impossible to resume decoding from the stream. The :meth:`read` "
|
|
|
|
|
"method will now return as much data as it can and future calls will resume "
|
|
|
|
|
"decoding where previous ones left off. (Implemented by Walter Dörwald.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1030
|
|
|
|
|
msgid ""
|
|
|
|
|
"There is a new :mod:`collections` module for various specialized collection "
|
2017-04-02 20:14:06 +00:00
|
|
|
|
"datatypes. Currently it contains just one type, :class:`deque`, a double-"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
"ended queue that supports efficiently adding and removing elements from "
|
|
|
|
|
"either end::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1050
|
|
|
|
|
msgid ""
|
|
|
|
|
"Several modules, such as the :mod:`Queue` and :mod:`threading` modules, now "
|
|
|
|
|
"take advantage of :class:`collections.deque` for improved performance. "
|
|
|
|
|
"(Contributed by Raymond Hettinger.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1054
|
|
|
|
|
msgid ""
|
|
|
|
|
"The :mod:`ConfigParser` classes have been enhanced slightly. The :meth:"
|
|
|
|
|
"`read` method now returns a list of the files that were successfully parsed, "
|
|
|
|
|
"and the :meth:`set` method raises :exc:`TypeError` if passed a *value* "
|
|
|
|
|
"argument that isn't a string. (Contributed by John Belmonte and David "
|
|
|
|
|
"Goodger.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1059
|
|
|
|
|
msgid ""
|
|
|
|
|
"The :mod:`curses` module now supports the ncurses extension :func:"
|
|
|
|
|
"`use_default_colors`. On platforms where the terminal supports "
|
|
|
|
|
"transparency, this makes it possible to use a transparent background. "
|
|
|
|
|
"(Contributed by Jörg Lehmann.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1064
|
|
|
|
|
msgid ""
|
|
|
|
|
"The :mod:`difflib` module now includes an :class:`HtmlDiff` class that "
|
|
|
|
|
"creates an HTML table showing a side by side comparison of two versions of a "
|
|
|
|
|
"text. (Contributed by Dan Gass.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1068
|
|
|
|
|
msgid ""
|
|
|
|
|
"The :mod:`email` package was updated to version 3.0, which dropped various "
|
|
|
|
|
"deprecated APIs and removes support for Python versions earlier than 2.3. "
|
|
|
|
|
"The 3.0 version of the package uses a new incremental parser for MIME "
|
|
|
|
|
"messages, available in the :mod:`email.FeedParser` module. The new parser "
|
|
|
|
|
"doesn't require reading the entire message into memory, and doesn't raise "
|
|
|
|
|
"exceptions if a message is malformed; instead it records any problems in "
|
|
|
|
|
"the :attr:`defect` attribute of the message. (Developed by Anthony Baxter, "
|
|
|
|
|
"Barry Warsaw, Thomas Wouters, and others.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1077
|
|
|
|
|
msgid ""
|
|
|
|
|
"The :mod:`heapq` module has been converted to C. The resulting tenfold "
|
|
|
|
|
"improvement in speed makes the module suitable for handling high volumes of "
|
|
|
|
|
"data. In addition, the module has two new functions :func:`nlargest` and :"
|
|
|
|
|
"func:`nsmallest` that use heaps to find the N largest or smallest values in "
|
|
|
|
|
"a dataset without the expense of a full sort. (Contributed by Raymond "
|
|
|
|
|
"Hettinger.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1083
|
|
|
|
|
msgid ""
|
|
|
|
|
"The :mod:`httplib` module now contains constants for HTTP status codes "
|
|
|
|
|
"defined in various HTTP-related RFC documents. Constants have names such "
|
|
|
|
|
"as :const:`OK`, :const:`CREATED`, :const:`CONTINUE`, and :const:"
|
|
|
|
|
"`MOVED_PERMANENTLY`; use pydoc to get a full list. (Contributed by Andrew "
|
|
|
|
|
"Eland.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1089
|
|
|
|
|
msgid ""
|
|
|
|
|
"The :mod:`imaplib` module now supports IMAP's THREAD command (contributed by "
|
|
|
|
|
"Yves Dionne) and new :meth:`deleteacl` and :meth:`myrights` methods "
|
|
|
|
|
"(contributed by Arnaud Mazin)."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1093
|
|
|
|
|
msgid ""
|
|
|
|
|
"The :mod:`itertools` module gained a ``groupby(iterable[, *func*])`` "
|
|
|
|
|
"function. *iterable* is something that can be iterated over to return a "
|
|
|
|
|
"stream of elements, and the optional *func* parameter is a function that "
|
|
|
|
|
"takes an element and returns a key value; if omitted, the key is simply the "
|
|
|
|
|
"element itself. :func:`groupby` then groups the elements into subsequences "
|
|
|
|
|
"which have matching values of the key, and returns a series of 2-tuples "
|
|
|
|
|
"containing the key value and an iterator over the subsequence."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1101
|
|
|
|
|
msgid ""
|
|
|
|
|
"Here's an example to make this clearer. The *key* function simply returns "
|
|
|
|
|
"whether a number is even or odd, so the result of :func:`groupby` is to "
|
|
|
|
|
"return consecutive runs of odd or even numbers. ::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1117
|
|
|
|
|
msgid ""
|
|
|
|
|
":func:`groupby` is typically used with sorted input. The logic for :func:"
|
|
|
|
|
"`groupby` is similar to the Unix ``uniq`` filter which makes it handy for "
|
|
|
|
|
"eliminating, counting, or identifying duplicate elements::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1140
|
|
|
|
|
msgid "(Contributed by Hye-Shik Chang.)"
|
|
|
|
|
msgstr "(Contribution par Hye-Shik Chang.)"
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1142
|
|
|
|
|
msgid ""
|
|
|
|
|
":mod:`itertools` also gained a function named ``tee(iterator, N)`` that "
|
|
|
|
|
"returns *N* independent iterators that replicate *iterator*. If *N* is "
|
|
|
|
|
"omitted, the default is 2. ::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1155
|
|
|
|
|
msgid ""
|
|
|
|
|
"Note that :func:`tee` has to keep copies of the values returned by the "
|
|
|
|
|
"iterator; in the worst case, it may need to keep all of them. This should "
|
|
|
|
|
"therefore be used carefully if the leading iterator can run far ahead of the "
|
|
|
|
|
"trailing iterator in a long stream of inputs. If the separation is large, "
|
|
|
|
|
"then you might as well use :func:`list` instead. When the iterators track "
|
|
|
|
|
"closely with one another, :func:`tee` is ideal. Possible applications "
|
|
|
|
|
"include bookmarking, windowing, or lookahead iterators. (Contributed by "
|
|
|
|
|
"Raymond Hettinger.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1164
|
|
|
|
|
msgid ""
|
|
|
|
|
"A number of functions were added to the :mod:`locale` module, such as :func:"
|
|
|
|
|
"`bind_textdomain_codeset` to specify a particular encoding and a family of :"
|
|
|
|
|
"func:`l\\*gettext` functions that return messages in the chosen encoding. "
|
|
|
|
|
"(Contributed by Gustavo Niemeyer.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1169
|
|
|
|
|
msgid ""
|
|
|
|
|
"Some keyword arguments were added to the :mod:`logging` package's :func:"
|
|
|
|
|
"`basicConfig` function to simplify log configuration. The default behavior "
|
|
|
|
|
"is to log messages to standard error, but various keyword arguments can be "
|
|
|
|
|
"specified to log to a particular file, change the logging format, or set the "
|
|
|
|
|
"logging level. For example::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1180
|
|
|
|
|
msgid ""
|
|
|
|
|
"Other additions to the :mod:`logging` package include a ``log(level, msg)`` "
|
|
|
|
|
"convenience method, as well as a :class:`TimedRotatingFileHandler` class "
|
|
|
|
|
"that rotates its log files at a timed interval. The module already had :"
|
|
|
|
|
"class:`RotatingFileHandler`, which rotated logs once the file exceeded a "
|
|
|
|
|
"certain size. Both classes derive from a new :class:`BaseRotatingHandler` "
|
|
|
|
|
"class that can be used to implement other rotating handlers."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1187
|
|
|
|
|
msgid "(Changes implemented by Vinay Sajip.)"
|
|
|
|
|
msgstr "(Changements implémentés par Vinay Sajip.)"
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1189
|
|
|
|
|
msgid ""
|
|
|
|
|
"The :mod:`marshal` module now shares interned strings on unpacking a data "
|
|
|
|
|
"structure. This may shrink the size of certain pickle strings, but the "
|
|
|
|
|
"primary effect is to make :file:`.pyc` files significantly smaller. "
|
|
|
|
|
"(Contributed by Martin von Löwis.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1194
|
|
|
|
|
msgid ""
|
|
|
|
|
"The :mod:`nntplib` module's :class:`NNTP` class gained :meth:`description` "
|
|
|
|
|
"and :meth:`descriptions` methods to retrieve newsgroup descriptions for a "
|
|
|
|
|
"single group or for a range of groups. (Contributed by Jürgen A. Erhard.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1198
|
|
|
|
|
msgid ""
|
|
|
|
|
"Two new functions were added to the :mod:`operator` module, "
|
|
|
|
|
"``attrgetter(attr)`` and ``itemgetter(index)``. Both functions return "
|
|
|
|
|
"callables that take a single argument and return the corresponding attribute "
|
|
|
|
|
"or item; these callables make excellent data extractors when used with :func:"
|
|
|
|
|
"`map` or :func:`sorted`. For example::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1214
|
|
|
|
|
msgid ""
|
|
|
|
|
"The :mod:`optparse` module was updated in various ways. The module now "
|
|
|
|
|
"passes its messages through :func:`gettext.gettext`, making it possible to "
|
|
|
|
|
"internationalize Optik's help and error messages. Help messages for options "
|
|
|
|
|
"can now include the string ``'%default'``, which will be replaced by the "
|
|
|
|
|
"option's default value. (Contributed by Greg Ward.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1220
|
|
|
|
|
msgid ""
|
|
|
|
|
"The long-term plan is to deprecate the :mod:`rfc822` module in some future "
|
|
|
|
|
"Python release in favor of the :mod:`email` package. To this end, the :func:"
|
|
|
|
|
"`email.Utils.formatdate` function has been changed to make it usable as a "
|
|
|
|
|
"replacement for :func:`rfc822.formatdate`. You may want to write new e-mail "
|
|
|
|
|
"processing code with this in mind. (Change implemented by Anthony Baxter.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1226
|
|
|
|
|
msgid ""
|
|
|
|
|
"A new ``urandom(n)`` function was added to the :mod:`os` module, returning a "
|
|
|
|
|
"string containing *n* bytes of random data. This function provides access "
|
|
|
|
|
"to platform-specific sources of randomness such as :file:`/dev/urandom` on "
|
|
|
|
|
"Linux or the Windows CryptoAPI. (Contributed by Trevor Perrin.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1231
|
|
|
|
|
msgid ""
|
|
|
|
|
"Another new function: ``os.path.lexists(path)`` returns true if the file "
|
|
|
|
|
"specified by *path* exists, whether or not it's a symbolic link. This "
|
|
|
|
|
"differs from the existing ``os.path.exists(path)`` function, which returns "
|
|
|
|
|
"false if *path* is a symlink that points to a destination that doesn't "
|
|
|
|
|
"exist. (Contributed by Beni Cherniavsky.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1237
|
|
|
|
|
msgid ""
|
|
|
|
|
"A new :func:`getsid` function was added to the :mod:`posix` module that "
|
|
|
|
|
"underlies the :mod:`os` module. (Contributed by J. Raynor.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1240
|
|
|
|
|
msgid ""
|
|
|
|
|
"The :mod:`poplib` module now supports POP over SSL. (Contributed by Hector "
|
|
|
|
|
"Urtubia.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
"Le module :mod:`poplib` supporte maintenant POP sur SSL. (Contribution par "
|
|
|
|
|
"Hector Urtubia.)"
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1243
|
|
|
|
|
msgid ""
|
|
|
|
|
"The :mod:`profile` module can now profile C extension functions. "
|
|
|
|
|
"(Contributed by Nick Bastin.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1246
|
|
|
|
|
msgid ""
|
|
|
|
|
"The :mod:`random` module has a new method called ``getrandbits(N)`` that "
|
|
|
|
|
"returns a long integer *N* bits in length. The existing :meth:`randrange` "
|
|
|
|
|
"method now uses :meth:`getrandbits` where appropriate, making generation of "
|
|
|
|
|
"arbitrarily large random numbers more efficient. (Contributed by Raymond "
|
|
|
|
|
"Hettinger.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1252
|
|
|
|
|
msgid ""
|
|
|
|
|
"The regular expression language accepted by the :mod:`re` module was "
|
|
|
|
|
"extended with simple conditional expressions, written as ``(?(group)A|B)``. "
|
|
|
|
|
"*group* is either a numeric group ID or a group name defined with ``(?"
|
|
|
|
|
"P<group>...)`` earlier in the expression. If the specified group matched, "
|
|
|
|
|
"the regular expression pattern *A* will be tested against the string; if the "
|
|
|
|
|
"group didn't match, the pattern *B* will be used instead. (Contributed by "
|
|
|
|
|
"Gustavo Niemeyer.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1259
|
|
|
|
|
msgid ""
|
|
|
|
|
"The :mod:`re` module is also no longer recursive, thanks to a massive amount "
|
|
|
|
|
"of work by Gustavo Niemeyer. In a recursive regular expression engine, "
|
|
|
|
|
"certain patterns result in a large amount of C stack space being consumed, "
|
|
|
|
|
"and it was possible to overflow the stack. For example, if you matched a "
|
|
|
|
|
"30000-byte string of ``a`` characters against the expression ``(a|b)+``, one "
|
|
|
|
|
"stack frame was consumed per character. Python 2.3 tried to check for stack "
|
|
|
|
|
"overflow and raise a :exc:`RuntimeError` exception, but certain patterns "
|
|
|
|
|
"could sidestep the checking and if you were unlucky Python could segfault. "
|
|
|
|
|
"Python 2.4's regular expression engine can match this pattern without "
|
|
|
|
|
"problems."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1269
|
|
|
|
|
msgid ""
|
|
|
|
|
"The :mod:`signal` module now performs tighter error-checking on the "
|
|
|
|
|
"parameters to the :func:`signal.signal` function. For example, you can't "
|
|
|
|
|
"set a handler on the :const:`SIGKILL` signal; previous versions of Python "
|
|
|
|
|
"would quietly accept this, but 2.4 will raise a :exc:`RuntimeError` "
|
|
|
|
|
"exception."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1274
|
|
|
|
|
msgid ""
|
|
|
|
|
"Two new functions were added to the :mod:`socket` module. :func:`socketpair` "
|
|
|
|
|
"returns a pair of connected sockets and ``getservbyport(port)`` looks up the "
|
|
|
|
|
"service name for a given port number. (Contributed by Dave Cole and Barry "
|
|
|
|
|
"Warsaw.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1279
|
|
|
|
|
msgid ""
|
|
|
|
|
"The :func:`sys.exitfunc` function has been deprecated. Code should be using "
|
|
|
|
|
"the existing :mod:`atexit` module, which correctly handles calling multiple "
|
|
|
|
|
"exit functions. Eventually :func:`sys.exitfunc` will become a purely "
|
|
|
|
|
"internal interface, accessed only by :mod:`atexit`."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1284
|
|
|
|
|
msgid ""
|
|
|
|
|
"The :mod:`tarfile` module now generates GNU-format tar files by default. "
|
|
|
|
|
"(Contributed by Lars Gustäbel.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1287
|
|
|
|
|
msgid ""
|
|
|
|
|
"The :mod:`threading` module now has an elegantly simple way to support "
|
|
|
|
|
"thread-local data. The module contains a :class:`local` class whose "
|
|
|
|
|
"attribute values are local to different threads. ::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1297
|
|
|
|
|
msgid ""
|
|
|
|
|
"Other threads can assign and retrieve their own values for the :attr:"
|
|
|
|
|
"`number` and :attr:`url` attributes. You can subclass :class:`local` to "
|
|
|
|
|
"initialize attributes or to add methods. (Contributed by Jim Fulton.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1301
|
|
|
|
|
msgid ""
|
|
|
|
|
"The :mod:`timeit` module now automatically disables periodic garbage "
|
|
|
|
|
"collection during the timing loop. This change makes consecutive timings "
|
|
|
|
|
"more comparable. (Contributed by Raymond Hettinger.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1305
|
|
|
|
|
msgid ""
|
|
|
|
|
"The :mod:`weakref` module now supports a wider variety of objects including "
|
|
|
|
|
"Python functions, class instances, sets, frozensets, deques, arrays, files, "
|
|
|
|
|
"sockets, and regular expression pattern objects. (Contributed by Raymond "
|
|
|
|
|
"Hettinger.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1310
|
|
|
|
|
msgid ""
|
|
|
|
|
"The :mod:`xmlrpclib` module now supports a multi-call extension for "
|
|
|
|
|
"transmitting multiple XML-RPC calls in a single HTTP operation. (Contributed "
|
|
|
|
|
"by Brian Quinlan.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1314
|
|
|
|
|
msgid ""
|
|
|
|
|
"The :mod:`mpz`, :mod:`rotor`, and :mod:`xreadlines` modules have been "
|
|
|
|
|
"removed."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1323
|
|
|
|
|
msgid "cookielib"
|
|
|
|
|
msgstr "cookielib"
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1325
|
|
|
|
|
msgid ""
|
|
|
|
|
"The :mod:`cookielib` library supports client-side handling for HTTP cookies, "
|
|
|
|
|
"mirroring the :mod:`Cookie` module's server-side cookie support. Cookies are "
|
|
|
|
|
"stored in cookie jars; the library transparently stores cookies offered by "
|
|
|
|
|
"the web server in the cookie jar, and fetches the cookie from the jar when "
|
|
|
|
|
"connecting to the server. As in web browsers, policy objects control whether "
|
|
|
|
|
"cookies are accepted or not."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1332
|
|
|
|
|
msgid ""
|
|
|
|
|
"In order to store cookies across sessions, two implementations of cookie "
|
|
|
|
|
"jars are provided: one that stores cookies in the Netscape format so "
|
|
|
|
|
"applications can use the Mozilla or Lynx cookie files, and one that stores "
|
|
|
|
|
"cookies in the same format as the Perl libwww library."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1337
|
|
|
|
|
msgid ""
|
|
|
|
|
":mod:`urllib2` has been changed to interact with :mod:`cookielib`: :class:"
|
|
|
|
|
"`HTTPCookieProcessor` manages a cookie jar that is used when accessing URLs."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1341
|
|
|
|
|
msgid "This module was contributed by John J. Lee."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1347
|
|
|
|
|
msgid "doctest"
|
|
|
|
|
msgstr "doctest"
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1349
|
|
|
|
|
msgid ""
|
|
|
|
|
"The :mod:`doctest` module underwent considerable refactoring thanks to "
|
|
|
|
|
"Edward Loper and Tim Peters. Testing can still be as simple as running :"
|
|
|
|
|
"func:`doctest.testmod`, but the refactorings allow customizing the module's "
|
|
|
|
|
"operation in various ways"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1354
|
|
|
|
|
msgid ""
|
|
|
|
|
"The new :class:`DocTestFinder` class extracts the tests from a given "
|
|
|
|
|
"object's docstrings::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1370
|
|
|
|
|
msgid ""
|
|
|
|
|
"The new :class:`DocTestRunner` class then runs individual tests and can "
|
|
|
|
|
"produce a summary of the results::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1379
|
|
|
|
|
msgid "The above example produces the following output::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1387
|
|
|
|
|
msgid ""
|
|
|
|
|
":class:`DocTestRunner` uses an instance of the :class:`OutputChecker` class "
|
|
|
|
|
"to compare the expected output with the actual output. This class takes a "
|
|
|
|
|
"number of different flags that customize its behaviour; ambitious users can "
|
|
|
|
|
"also write a completely new subclass of :class:`OutputChecker`."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1392
|
|
|
|
|
msgid ""
|
|
|
|
|
"The default output checker provides a number of handy features. For example, "
|
|
|
|
|
"with the :const:`doctest.ELLIPSIS` option flag, an ellipsis (``...``) in the "
|
|
|
|
|
"expected output matches any substring, making it easier to accommodate "
|
|
|
|
|
"outputs that vary in minor ways::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1403
|
|
|
|
|
msgid "Another special string, ``<BLANKLINE>``, matches a blank line::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1411
|
|
|
|
|
msgid ""
|
|
|
|
|
"Another new capability is producing a diff-style display of the output by "
|
|
|
|
|
"specifying the :const:`doctest.REPORT_UDIFF` (unified diffs), :const:"
|
|
|
|
|
"`doctest.REPORT_CDIFF` (context diffs), or :const:`doctest.REPORT_NDIFF` "
|
|
|
|
|
"(delta-style) option flags. For example::"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1427
|
|
|
|
|
msgid ""
|
|
|
|
|
"Running the above function's tests with :const:`doctest.REPORT_UDIFF` "
|
|
|
|
|
"specified, you get the following output:"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1448
|
|
|
|
|
msgid "Build and C API Changes"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1450
|
|
|
|
|
msgid "Some of the changes to Python's build process and to the C API are:"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1452
|
|
|
|
|
msgid ""
|
|
|
|
|
"Three new convenience macros were added for common return values from "
|
|
|
|
|
"extension functions: :c:macro:`Py_RETURN_NONE`, :c:macro:`Py_RETURN_TRUE`, "
|
|
|
|
|
"and :c:macro:`Py_RETURN_FALSE`. (Contributed by Brett Cannon.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1456
|
|
|
|
|
msgid ""
|
|
|
|
|
"Another new macro, :c:macro:`Py_CLEAR(obj)`, decreases the reference count "
|
|
|
|
|
"of *obj* and sets *obj* to the null pointer. (Contributed by Jim Fulton.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1459
|
|
|
|
|
msgid ""
|
|
|
|
|
"A new function, ``PyTuple_Pack(N, obj1, obj2, ..., objN)``, constructs "
|
|
|
|
|
"tuples from a variable length argument list of Python objects. (Contributed "
|
|
|
|
|
"by Raymond Hettinger.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1463
|
|
|
|
|
msgid ""
|
|
|
|
|
"A new function, ``PyDict_Contains(d, k)``, implements fast dictionary "
|
|
|
|
|
"lookups without masking exceptions raised during the look-up process. "
|
|
|
|
|
"(Contributed by Raymond Hettinger.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1467
|
|
|
|
|
msgid ""
|
|
|
|
|
"The :c:macro:`Py_IS_NAN(X)` macro returns 1 if its float or double argument "
|
|
|
|
|
"*X* is a NaN. (Contributed by Tim Peters.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1470
|
|
|
|
|
msgid ""
|
|
|
|
|
"C code can avoid unnecessary locking by using the new :c:func:"
|
|
|
|
|
"`PyEval_ThreadsInitialized` function to tell if any thread operations have "
|
|
|
|
|
"been performed. If this function returns false, no lock operations are "
|
|
|
|
|
"needed. (Contributed by Nick Coghlan.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1475
|
|
|
|
|
msgid ""
|
|
|
|
|
"A new function, :c:func:`PyArg_VaParseTupleAndKeywords`, is the same as :c:"
|
|
|
|
|
"func:`PyArg_ParseTupleAndKeywords` but takes a :c:type:`va_list` instead of "
|
|
|
|
|
"a number of arguments. (Contributed by Greg Chapman.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1479
|
|
|
|
|
msgid ""
|
|
|
|
|
"A new method flag, :const:`METH_COEXISTS`, allows a function defined in "
|
|
|
|
|
"slots to co-exist with a :c:type:`PyCFunction` having the same name. This "
|
|
|
|
|
"can halve the access time for a method such as :meth:`set.__contains__`. "
|
|
|
|
|
"(Contributed by Raymond Hettinger.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1484
|
|
|
|
|
msgid ""
|
|
|
|
|
"Python can now be built with additional profiling for the interpreter "
|
|
|
|
|
"itself, intended as an aid to people developing the Python core. Providing :"
|
2017-04-02 20:14:06 +00:00
|
|
|
|
"option:`!--enable-profiling` to the :program:`configure` script will let you "
|
|
|
|
|
"profile the interpreter with :program:`gprof`, and providing the :option:`!--"
|
|
|
|
|
"with-tsc` switch enables profiling using the Pentium's Time-Stamp-Counter "
|
|
|
|
|
"register. Note that the :option:`!--with-tsc` switch is slightly misnamed, "
|
2016-10-30 09:46:26 +00:00
|
|
|
|
"because the profiling feature also works on the PowerPC platform, though "
|
|
|
|
|
"that processor architecture doesn't call that register \"the TSC register"
|
|
|
|
|
"\". (Contributed by Jeremy Hylton.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1494
|
|
|
|
|
msgid ""
|
|
|
|
|
"The :c:type:`tracebackobject` type has been renamed to :c:type:"
|
|
|
|
|
"`PyTracebackObject`."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1501
|
|
|
|
|
msgid "Port-Specific Changes"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1503
|
|
|
|
|
msgid ""
|
|
|
|
|
"The Windows port now builds under MSVC++ 7.1 as well as version 6. "
|
|
|
|
|
"(Contributed by Martin von Löwis.)"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1510
|
|
|
|
|
msgid "Porting to Python 2.4"
|
|
|
|
|
msgstr "Portage vers Python 2.4"
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1512
|
|
|
|
|
msgid ""
|
|
|
|
|
"This section lists previously described changes that may require changes to "
|
|
|
|
|
"your code:"
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1515
|
|
|
|
|
msgid ""
|
|
|
|
|
"Left shifts and hexadecimal/octal constants that are too large no longer "
|
|
|
|
|
"trigger a :exc:`FutureWarning` and return a value limited to 32 or 64 bits; "
|
|
|
|
|
"instead they return a long integer."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1522
|
|
|
|
|
msgid ""
|
|
|
|
|
"The :func:`zip` built-in function and :func:`itertools.izip` now return an "
|
|
|
|
|
"empty list instead of raising a :exc:`TypeError` exception if called with no "
|
|
|
|
|
"arguments."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1526
|
|
|
|
|
msgid ""
|
2017-04-02 20:14:06 +00:00
|
|
|
|
"You can no longer compare the :class:`date` and :class:`~datetime.datetime` "
|
|
|
|
|
"instances provided by the :mod:`datetime` module. Two instances of "
|
|
|
|
|
"different classes will now always be unequal, and relative comparisons "
|
|
|
|
|
"(``<``, ``>``) will raise a :exc:`TypeError`."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1531
|
|
|
|
|
msgid ""
|
|
|
|
|
":func:`dircache.listdir` now passes exceptions to the caller instead of "
|
|
|
|
|
"returning empty lists."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1534
|
|
|
|
|
msgid ""
|
|
|
|
|
":func:`LexicalHandler.startDTD` used to receive the public and system IDs in "
|
|
|
|
|
"the wrong order. This has been corrected; applications relying on the wrong "
|
|
|
|
|
"order need to be fixed."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1538
|
|
|
|
|
msgid ""
|
|
|
|
|
":func:`fcntl.ioctl` now warns if the *mutate* argument is omitted and "
|
|
|
|
|
"relevant."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1541
|
|
|
|
|
msgid ""
|
|
|
|
|
"The :mod:`tarfile` module now generates GNU-format tar files by default."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1543
|
|
|
|
|
msgid ""
|
2017-04-02 20:14:06 +00:00
|
|
|
|
"Encountering a failure while importing a module no longer leaves a partially-"
|
|
|
|
|
"initialized module object in ``sys.modules``."
|
2016-10-30 09:46:26 +00:00
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1546
|
|
|
|
|
msgid ""
|
|
|
|
|
":const:`None` is now a constant; code that binds a new value to the name "
|
|
|
|
|
"``None`` is now a syntax error."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1549
|
|
|
|
|
msgid ""
|
|
|
|
|
"The :func:`signals.signal` function now raises a :exc:`RuntimeError` "
|
|
|
|
|
"exception for certain illegal values; previously these errors would pass "
|
|
|
|
|
"silently. For example, you can no longer set a handler on the :const:"
|
|
|
|
|
"`SIGKILL` signal."
|
|
|
|
|
msgstr ""
|
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1559
|
|
|
|
|
msgid "Acknowledgements"
|
2017-12-05 06:54:15 +00:00
|
|
|
|
msgstr "Remerciements"
|
2016-10-30 09:46:26 +00:00
|
|
|
|
|
|
|
|
|
#: ../Doc/whatsnew/2.4.rst:1561
|
|
|
|
|
msgid ""
|
|
|
|
|
"The author would like to thank the following people for offering "
|
|
|
|
|
"suggestions, corrections and assistance with various drafts of this article: "
|
|
|
|
|
"Koray Can, Hye-Shik Chang, Michael Dyck, Raymond Hettinger, Brian Hurt, "
|
|
|
|
|
"Hamish Lawson, Fredrik Lundh, Sean Reifschneider, Sadruddin Rejeb."
|
|
|
|
|
msgstr ""
|