python-docs-fr/whatsnew.po

17496 lines
681 KiB
Plaintext

# SOME DESCRIPTIVE TITLE.
# Copyright (C) 1990-2010, Python Software Foundation
# This file is distributed under the same license as the Python package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-11-17 04:01\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Translate Toolkit 1.7.0\n"
#: ../src/Doc/whatsnew/2.0.rst:3
msgid "What's New in Python 2.0"
msgstr "Nouveautés de Python 2.0"
#: ../src/Doc/whatsnew/2.0.rst:5
msgid "A.M. Kuchling and Moshe Zadka"
msgstr "A.M. Kuchling et Moshe Zadka"
#: ../src/Doc/whatsnew/2.0.rst:13 ../src/Doc/whatsnew/2.1.rst:13
#: ../src/Doc/whatsnew/2.2.rst:13
msgid "Introduction"
msgstr "Introduction"
#: ../src/Doc/whatsnew/2.0.rst:15
#, fuzzy
msgid ""
"A new release of Python, version 2.0, was released on October 16, 2000. This "
"article covers the exciting new features in 2.0, highlights some other "
"useful changes, and points out a few incompatible changes that may require "
"rewriting code."
msgstr ""
"Une nouvelle version de Python, la version 2.0, est sortie le 16 octobre "
"2000. Cet article traite des nouvelles fonctionnalités intéressantes de "
"cette version, met en évidence d'autres changements utiles, et souligne "
"quelques incompatibilités qui peuvent nécessiter la réécriture du code."
#: ../src/Doc/whatsnew/2.0.rst:20
#, fuzzy
msgid ""
"Python's development never completely stops between releases, and a steady "
"flow of bug fixes and improvements are always being submitted. A host of "
"minor fixes, a few optimizations, additional docstrings, and better error "
"messages went into 2.0; to list them all would be impossible, but they're "
"certainly significant. Consult the publicly-available CVS logs if you want "
"to see the full list. This progress is due to the five developers working "
"for PythonLabs are now getting paid to spend their days fixing bugs, and "
"also due to the improved communication resulting from moving to SourceForge."
msgstr ""
"Le développement de Python n'a jamais complétement été arrêté entre chaque "
"versions, et un flux constant de corrections de bogues et d'améliorations "
"ont toujours été soumis. Une foule de corrections mineures, quelques "
"optimisations, des docstrings supplémentaires, et de meilleurs messages "
"d'erreur sont apparus avec l'arrivée de la version 2.0; tous les énumérer "
"serait impossible, mais ils sont certainement significatif. Consultez les "
"journaux CVS publics disponibles pour obtenir la liste complète. Ce progrès "
"est dû aux cinq développeurs travaillant pour PythonLabs qui sont désormais "
"payés pour passer leurs journées à corriger les bugs, mais aussi en raison "
"de l'amélioration de la communication résultant du passage à SourceForge."
#: ../src/Doc/whatsnew/2.0.rst:33
#, fuzzy
msgid "What About Python 1.6?"
msgstr "A propos de Python 1.6"
#: ../src/Doc/whatsnew/2.0.rst:35
msgid ""
"Python 1.6 can be thought of as the Contractual Obligations Python release. "
"After the core development team left CNRI in May 2000, CNRI requested that a "
"1.6 release be created, containing all the work on Python that had been "
"performed at CNRI. Python 1.6 therefore represents the state of the CVS "
"tree as of May 2000, with the most significant new feature being Unicode "
"support. Development continued after May, of course, so the 1.6 tree "
"received a few fixes to ensure that it's forward-compatible with Python "
"2.0. 1.6 is therefore part of Python's evolution, and not a side branch."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:44
msgid ""
"So, should you take much interest in Python 1.6? Probably not. The "
"1.6final and 2.0beta1 releases were made on the same day (September 5, "
"2000), the plan being to finalize Python 2.0 within a month or so. If you "
"have applications to maintain, there seems little point in breaking things "
"by moving to 1.6, fixing them, and then having another round of breakage "
"within a month by moving to 2.0; you're better off just going straight to "
"2.0. Most of the really interesting features described in this document are "
"only in 2.0, because a lot of work was done between May and September."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:57
msgid "New Development Process"
msgstr "Nouveau processus de développement"
#: ../src/Doc/whatsnew/2.0.rst:59
msgid ""
"The most important change in Python 2.0 may not be to the code at all, but "
"to how Python is developed: in May 2000 the Python developers began using "
"the tools made available by SourceForge for storing source code, tracking "
"bug reports, and managing the queue of patch submissions. To report bugs or "
"submit patches for Python 2.0, use the bug tracking and patch manager tools "
"available from Python's project page, located at http://sourceforge.net/"
"projects/python/."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:66
msgid ""
"The most important of the services now hosted at SourceForge is the Python "
"CVS tree, the version-controlled repository containing the source code for "
"Python. Previously, there were roughly 7 or so people who had write access "
"to the CVS tree, and all patches had to be inspected and checked in by one "
"of the people on this short list. Obviously, this wasn't very scalable. By "
"moving the CVS tree to SourceForge, it became possible to grant write access "
"to more people; as of September 2000 there were 27 people able to check in "
"changes, a fourfold increase. This makes possible large-scale changes that "
"wouldn't be attempted if they'd have to be filtered through the small group "
"of core developers. For example, one day Peter Schneider-Kamp took it into "
"his head to drop K&R C compatibility and convert the C source for Python to "
"ANSI C. After getting approval on the python-dev mailing list, he launched "
"into a flurry of checkins that lasted about a week, other developers joined "
"in to help, and the job was done. If there were only 5 people with write "
"access, probably that task would have been viewed as \"nice, but not worth "
"the time and effort needed\" and it would never have gotten done."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:83
msgid ""
"The shift to using SourceForge's services has resulted in a remarkable "
"increase in the speed of development. Patches now get submitted, commented "
"on, revised by people other than the original submitter, and bounced back "
"and forth between people until the patch is deemed worth checking in. Bugs "
"are tracked in one central location and can be assigned to a specific person "
"for fixing, and we can count the number of open bugs to measure progress. "
"This didn't come without a cost: developers now have more e-mail to deal "
"with, more mailing lists to follow, and special tools had to be written for "
"the new environment. For example, SourceForge sends default patch and bug "
"notification e-mail messages that are completely unhelpful, so Ka-Ping Yee "
"wrote an HTML screen-scraper that sends more useful messages."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:95
msgid ""
"The ease of adding code caused a few initial growing pains, such as code was "
"checked in before it was ready or without getting clear agreement from the "
"developer group. The approval process that has emerged is somewhat similar "
"to that used by the Apache group. Developers can vote +1, +0, -0, or -1 on a "
"patch; +1 and -1 denote acceptance or rejection, while +0 and -0 mean the "
"developer is mostly indifferent to the change, though with a slight positive "
"or negative slant. The most significant change from the Apache model is "
"that the voting is essentially advisory, letting Guido van Rossum, who has "
"Benevolent Dictator For Life status, know what the general opinion is. He "
"can still ignore the result of a vote, and approve or reject a change even "
"if the community disagrees with him."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:106
msgid ""
"Producing an actual patch is the last step in adding a new feature, and is "
"usually easy compared to the earlier task of coming up with a good design. "
"Discussions of new features can often explode into lengthy mailing list "
"threads, making the discussion hard to follow, and no one can read every "
"posting to python-dev. Therefore, a relatively formal process has been set "
"up to write Python Enhancement Proposals (PEPs), modelled on the Internet "
"RFC process. PEPs are draft documents that describe a proposed new feature, "
"and are continually revised until the community reaches a consensus, either "
"accepting or rejecting the proposal. Quoting from the introduction to PEP "
"1, \"PEP Purpose and Guidelines\":"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:120
msgid ""
"PEP stands for Python Enhancement Proposal. A PEP is a design document "
"providing information to the Python community, or describing a new feature "
"for Python. The PEP should provide a concise technical specification of the "
"feature and a rationale for the feature."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:125
msgid ""
"We intend PEPs to be the primary mechanisms for proposing new features, for "
"collecting community input on an issue, and for documenting the design "
"decisions that have gone into Python. The PEP author is responsible for "
"building consensus within the community and documenting dissenting opinions."
msgstr ""
# 705ef47c2c6e4331b49fb92b63efc6bd
#: ../src/Doc/whatsnew/2.0.rst:130
msgid ""
"Read the rest of PEP 1 for the details of the PEP editorial process, style, "
"and format. PEPs are kept in the Python CVS tree on SourceForge, though "
"they're not part of the Python 2.0 distribution, and are also available in "
"HTML form from https://www.python.org/peps/. As of September 2000, there "
"are 25 PEPS, ranging from PEP 201, \"Lockstep Iteration\", to PEP 225, "
"\"Elementwise/Objectwise Operators\"."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:141
msgid "Unicode"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:143
msgid ""
"The largest new feature in Python 2.0 is a new fundamental data type: "
"Unicode strings. Unicode uses 16-bit numbers to represent characters "
"instead of the 8-bit number used by ASCII, meaning that 65,536 distinct "
"characters can be supported."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:148
msgid ""
"The final interface for Unicode support was arrived at through countless "
"often- stormy discussions on the python-dev mailing list, and mostly "
"implemented by Marc-André Lemburg, based on a Unicode string type "
"implementation by Fredrik Lundh. A detailed explanation of the interface "
"was written up as :pep:`100`, \"Python Unicode Integration\". This article "
"will simply cover the most significant points about the Unicode interfaces."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:155
msgid ""
"In Python source code, Unicode strings are written as ``u\"string\"``. "
"Arbitrary Unicode characters can be written using a new escape sequence, ``"
"\\uHHHH``, where *HHHH* is a 4-digit hexadecimal number from 0000 to FFFF. "
"The existing ``\\xHHHH`` escape sequence can also be used, and octal escapes "
"can be used for characters up to U+01FF, which is represented by ``\\777``."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:161
msgid ""
"Unicode strings, just like regular strings, are an immutable sequence type. "
"They can be indexed and sliced, but not modified in place. Unicode strings "
"have an ``encode( [encoding] )`` method that returns an 8-bit string in the "
"desired encoding. Encodings are named by strings, such as ``'ascii'``, "
"``'utf-8'``, ``'iso-8859-1'``, or whatever. A codec API is defined for "
"implementing and registering new encodings that are then available "
"throughout a Python program. If an encoding isn't specified, the default "
"encoding is usually 7-bit ASCII, though it can be changed for your Python "
"installation by calling the :func:`sys.setdefaultencoding(encoding)` "
"function in a customised version of :file:`site.py`."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:172
msgid ""
"Combining 8-bit and Unicode strings always coerces to Unicode, using the "
"default ASCII encoding; the result of ``'a' + u'bc'`` is ``u'abc'``."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:175
msgid ""
"New built-in functions have been added, and existing built-ins modified to "
"support Unicode:"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:178
msgid ""
"``unichr(ch)`` returns a Unicode string 1 character long, containing the "
"character *ch*."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:181
msgid ""
"``ord(u)``, where *u* is a 1-character regular or Unicode string, returns "
"the number of the character as an integer."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:184
msgid ""
"``unicode(string [, encoding] [, errors] )`` creates a Unicode string from "
"an 8-bit string. ``encoding`` is a string naming the encoding to use. The "
"``errors`` parameter specifies the treatment of characters that are invalid "
"for the current encoding; passing ``'strict'`` as the value causes an "
"exception to be raised on any encoding error, while ``'ignore'`` causes "
"errors to be silently ignored and ``'replace'`` uses U+FFFD, the official "
"replacement character, in case of any problems."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:192
msgid ""
"The :keyword:`exec` statement, and various built-ins such as ``eval()``, "
"``getattr()``, and ``setattr()`` will also accept Unicode strings as well as "
"regular strings. (It's possible that the process of fixing this missed some "
"built-ins; if you find a built-in function that accepts strings but doesn't "
"accept Unicode strings at all, please report it as a bug.)"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:198
msgid ""
"A new module, :mod:`unicodedata`, provides an interface to Unicode character "
"properties. For example, ``unicodedata.category(u'A')`` returns the 2-"
"character string 'Lu', the 'L' denoting it's a letter, and 'u' meaning that "
"it's uppercase. ``unicodedata.bidirectional(u'\\u0660')`` returns 'AN', "
"meaning that U+0660 is an Arabic number."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:204
msgid ""
"The :mod:`codecs` module contains functions to look up existing encodings "
"and register new ones. Unless you want to implement a new encoding, you'll "
"most often use the :func:`codecs.lookup(encoding)` function, which returns a "
"4-element tuple: ``(encode_func, decode_func, stream_reader, "
"stream_writer)``."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:209
msgid ""
"*encode_func* is a function that takes a Unicode string, and returns a 2-"
"tuple ``(string, length)``. *string* is an 8-bit string containing a "
"portion (perhaps all) of the Unicode string converted into the given "
"encoding, and *length* tells you how much of the Unicode string was "
"converted."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:214
msgid ""
"*decode_func* is the opposite of *encode_func*, taking an 8-bit string and "
"returning a 2-tuple ``(ustring, length)``, consisting of the resulting "
"Unicode string *ustring* and the integer *length* telling how much of the 8-"
"bit string was consumed."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:219
msgid ""
"*stream_reader* is a class that supports decoding input from a stream. "
"*stream_reader(file_obj)* returns an object that supports the :meth:`read`, :"
"meth:`readline`, and :meth:`readlines` methods. These methods will all "
"translate from the given encoding and return Unicode strings."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:224
msgid ""
"*stream_writer*, similarly, is a class that supports encoding output to a "
"stream. *stream_writer(file_obj)* returns an object that supports the :meth:"
"`write` and :meth:`writelines` methods. These methods expect Unicode "
"strings, translating them to the given encoding on output."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:229
msgid ""
"For example, the following code writes a Unicode string into a file, "
"encoding it as UTF-8::"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:243
msgid "The following code would then read UTF-8 input from the file::"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:249
msgid ""
"Unicode-aware regular expressions are available through the :mod:`re` "
"module, which has a new underlying implementation called SRE written by "
"Fredrik Lundh of Secret Labs AB."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:253
msgid ""
"A ``-U`` command line option was added which causes the Python compiler to "
"interpret all string literals as Unicode string literals. This is intended "
"to be used in testing and future-proofing your Python code, since some "
"future version of Python may drop support for 8-bit strings and provide only "
"Unicode strings."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:262
msgid "List Comprehensions"
msgstr "Compréhensions de listes"
#: ../src/Doc/whatsnew/2.0.rst:264
msgid ""
"Lists are a workhorse data type in Python, and many programs manipulate a "
"list at some point. Two common operations on lists are to loop over them, "
"and either pick out the elements that meet a certain criterion, or apply "
"some function to each element. For example, given a list of strings, you "
"might want to pull out all the strings containing a given substring, or "
"strip off trailing whitespace from each line."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:271
msgid ""
"The existing :func:`map` and :func:`filter` functions can be used for this "
"purpose, but they require a function as one of their arguments. This is "
"fine if there's an existing built-in function that can be passed directly, "
"but if there isn't, you have to create a little function to do the required "
"work, and Python's scoping rules make the result ugly if the little function "
"needs additional information. Take the first example in the previous "
"paragraph, finding all the strings in the list containing a given "
"substring. You could write the following to do it::"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:286
msgid ""
"Because of Python's scoping rules, a default argument is used so that the "
"anonymous function created by the :keyword:`lambda` statement knows what "
"substring is being searched for. List comprehensions make this cleaner::"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:292
msgid "List comprehensions have the form::"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:299
msgid ""
"The :keyword:`for`...\\ :keyword:`in` clauses contain the sequences to be "
"iterated over. The sequences do not have to be the same length, because "
"they are *not* iterated over in parallel, but from left to right; this is "
"explained more clearly in the following paragraphs. The elements of the "
"generated list will be the successive values of *expression*. The final :"
"keyword:`if` clause is optional; if present, *expression* is only evaluated "
"and added to the result if *condition* is true."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:307
msgid ""
"To make the semantics very clear, a list comprehension is equivalent to the "
"following Python code::"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:319
msgid ""
"This means that when there are multiple :keyword:`for`...\\ :keyword:`in` "
"clauses, the resulting list will be equal to the product of the lengths of "
"all the sequences. If you have two lists of length 3, the output list is 9 "
"elements long::"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:330
msgid ""
"To avoid introducing an ambiguity into Python's grammar, if *expression* is "
"creating a tuple, it must be surrounded with parentheses. The first list "
"comprehension below is a syntax error, while the second one is correct::"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:339
msgid ""
"The idea of list comprehensions originally comes from the functional "
"programming language Haskell (http://www.haskell.org). Greg Ewing argued "
"most effectively for adding them to Python and wrote the initial list "
"comprehension patch, which was then discussed for a seemingly endless time "
"on the python-dev mailing list and kept up-to-date by Skip Montanaro."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:349
msgid "Augmented Assignment"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:351
msgid ""
"Augmented assignment operators, another long-requested feature, have been "
"added to Python 2.0. Augmented assignment operators include ``+=``, ``-=``, "
"``*=``, and so forth. For example, the statement ``a += 2`` increments the "
"value of the variable ``a`` by 2, equivalent to the slightly lengthier ``a "
"= a + 2``."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:356
msgid ""
"The full list of supported assignment operators is ``+=``, ``-=``, ``*=``, "
"``/=``, ``%=``, ``**=``, ``&=``, ``|=``, ``^=``, ``>>=``, and ``<<=``. "
"Python classes can override the augmented assignment operators by defining "
"methods named :meth:`__iadd__`, :meth:`__isub__`, etc. For example, the "
"following :class:`Number` class stores a number and supports using += to "
"create a new instance with an incremented value."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:377
msgid ""
"The :meth:`__iadd__` special method is called with the value of the "
"increment, and should return a new instance with an appropriately modified "
"value; this return value is bound as the new value of the variable on the "
"left-hand side."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:381
msgid ""
"Augmented assignment operators were first introduced in the C programming "
"language, and most C-derived languages, such as :program:`awk`, C++, Java, "
"Perl, and PHP also support them. The augmented assignment patch was "
"implemented by Thomas Wouters."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:390
msgid "String Methods"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:392
msgid ""
"Until now string-manipulation functionality was in the :mod:`string` module, "
"which was usually a front-end for the :mod:`strop` module written in C. The "
"addition of Unicode posed a difficulty for the :mod:`strop` module, because "
"the functions would all need to be rewritten in order to accept either 8-bit "
"or Unicode strings. For functions such as :func:`string.replace`, which "
"takes 3 string arguments, that means eight possible permutations, and "
"correspondingly complicated code."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:400
msgid ""
"Instead, Python 2.0 pushes the problem onto the string type, making string "
"manipulation functionality available through methods on both 8-bit strings "
"and Unicode strings. ::"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:411
msgid ""
"One thing that hasn't changed, a noteworthy April Fools' joke "
"notwithstanding, is that Python strings are immutable. Thus, the string "
"methods return new strings, and do not modify the string on which they "
"operate."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:415
msgid ""
"The old :mod:`string` module is still around for backwards compatibility, "
"but it mostly acts as a front-end to the new string methods."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:418
msgid ""
"Two methods which have no parallel in pre-2.0 versions, although they did "
"exist in JPython for quite some time, are :meth:`startswith` and :meth:"
"`endswith`. ``s.startswith(t)`` is equivalent to ``s[:len(t)] == t``, while "
"``s.endswith(t)`` is equivalent to ``s[-len(t):] == t``."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:423
msgid ""
"One other method which deserves special mention is :meth:`join`. The :meth:"
"`join` method of a string receives one parameter, a sequence of strings, and "
"is equivalent to the :func:`string.join` function from the old :mod:`string` "
"module, with the arguments reversed. In other words, ``s.join(seq)`` is "
"equivalent to the old ``string.join(seq, s)``."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:433
msgid "Garbage Collection of Cycles"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:435
msgid ""
"The C implementation of Python uses reference counting to implement garbage "
"collection. Every Python object maintains a count of the number of "
"references pointing to itself, and adjusts the count as references are "
"created or destroyed. Once the reference count reaches zero, the object is "
"no longer accessible, since you need to have a reference to an object to "
"access it, and if the count is zero, no references exist any longer."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:442
msgid ""
"Reference counting has some pleasant properties: it's easy to understand and "
"implement, and the resulting implementation is portable, fairly fast, and "
"reacts well with other libraries that implement their own memory handling "
"schemes. The major problem with reference counting is that it sometimes "
"doesn't realise that objects are no longer accessible, resulting in a memory "
"leak. This happens when there are cycles of references."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:449
msgid ""
"Consider the simplest possible cycle, a class instance which has a "
"reference to itself::"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:455
msgid ""
"After the above two lines of code have been executed, the reference count of "
"``instance`` is 2; one reference is from the variable named ``'instance'``, "
"and the other is from the ``myself`` attribute of the instance."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:459
msgid ""
"If the next line of code is ``del instance``, what happens? The reference "
"count of ``instance`` is decreased by 1, so it has a reference count of 1; "
"the reference in the ``myself`` attribute still exists. Yet the instance is "
"no longer accessible through Python code, and it could be deleted. Several "
"objects can participate in a cycle if they have references to each other, "
"causing all of the objects to be leaked."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:466
msgid ""
"Python 2.0 fixes this problem by periodically executing a cycle detection "
"algorithm which looks for inaccessible cycles and deletes the objects "
"involved. A new :mod:`gc` module provides functions to perform a garbage "
"collection, obtain debugging statistics, and tuning the collector's "
"parameters."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:471
msgid ""
"Running the cycle detection algorithm takes some time, and therefore will "
"result in some additional overhead. It is hoped that after we've gotten "
"experience with the cycle collection from using 2.0, Python 2.1 will be able "
"to minimize the overhead with careful tuning. It's not yet obvious how much "
"performance is lost, because benchmarking this is tricky and depends "
"crucially on how often the program creates and destroys objects. The "
"detection of cycles can be disabled when Python is compiled, if you can't "
"afford even a tiny speed penalty or suspect that the cycle collection is "
"buggy, by specifying the :option:`--without-cycle-gc` switch when running "
"the :program:`configure` script."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:482
msgid ""
"Several people tackled this problem and contributed to a solution. An early "
"implementation of the cycle detection approach was written by Toby Kelsey. "
"The current algorithm was suggested by Eric Tiedemann during a visit to "
"CNRI, and Guido van Rossum and Neil Schemenauer wrote two different "
"implementations, which were later integrated by Neil. Lots of other people "
"offered suggestions along the way; the March 2000 archives of the python-dev "
"mailing list contain most of the relevant discussion, especially in the "
"threads titled \"Reference cycle collection for Python\" and \"Finalization "
"again\"."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:495
msgid "Other Core Changes"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:497
msgid ""
"Various minor changes have been made to Python's syntax and built-in "
"functions. None of the changes are very far-reaching, but they're handy "
"conveniences."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:502
msgid "Minor Language Changes"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:504
msgid ""
"A new syntax makes it more convenient to call a given function with a tuple "
"of arguments and/or a dictionary of keyword arguments. In Python 1.5 and "
"earlier, you'd use the :func:`apply` built-in function: ``apply(f, args, "
"kw)`` calls the function :func:`f` with the argument tuple *args* and the "
"keyword arguments in the dictionary *kw*. :func:`apply` is the same in "
"2.0, but thanks to a patch from Greg Ewing, ``f(*args, **kw)`` as a shorter "
"and clearer way to achieve the same effect. This syntax is symmetrical with "
"the syntax for defining functions::"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:518
msgid ""
"The :keyword:`print` statement can now have its output directed to a file-"
"like object by following the :keyword:`print` with ``>> file``, similar to "
"the redirection operator in Unix shells. Previously you'd either have to use "
"the :meth:`write` method of the file-like object, which lacks the "
"convenience and simplicity of :keyword:`print`, or you could assign a new "
"value to ``sys.stdout`` and then restore the old value. For sending output "
"to standard error, it's much easier to write this::"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:528
msgid ""
"Modules can now be renamed on importing them, using the syntax ``import "
"module as name`` or ``from module import name as othername``. The patch was "
"submitted by Thomas Wouters."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:532
msgid ""
"A new format style is available when using the ``%`` operator; '%r' will "
"insert the :func:`repr` of its argument. This was also added from symmetry "
"considerations, this time for symmetry with the existing '%s' format style, "
"which inserts the :func:`str` of its argument. For example, ``'%r %s' % "
"('abc', 'abc')`` returns a string containing ``'abc' abc``."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:538
msgid ""
"Previously there was no way to implement a class that overrode Python's "
"built-in :keyword:`in` operator and implemented a custom version. ``obj in "
"seq`` returns true if *obj* is present in the sequence *seq*; Python "
"computes this by simply trying every index of the sequence until either "
"*obj* is found or an :exc:`IndexError` is encountered. Moshe Zadka "
"contributed a patch which adds a :meth:`__contains__` magic method for "
"providing a custom implementation for :keyword:`in`. Additionally, new built-"
"in objects written in C can define what :keyword:`in` means for them via a "
"new slot in the sequence protocol."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:547
msgid ""
"Earlier versions of Python used a recursive algorithm for deleting objects. "
"Deeply nested data structures could cause the interpreter to fill up the C "
"stack and crash; Christian Tismer rewrote the deletion logic to fix this "
"problem. On a related note, comparing recursive objects recursed infinitely "
"and crashed; Jeremy Hylton rewrote the code to no longer crash, producing a "
"useful result instead. For example, after this code::"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:559
msgid ""
"The comparison ``a==b`` returns true, because the two recursive data "
"structures are isomorphic. See the thread \"trashcan and PR#7\" in the April "
"2000 archives of the python-dev mailing list for the discussion leading up "
"to this implementation, and some useful relevant links. Note that "
"comparisons can now also raise exceptions. In earlier versions of Python, a "
"comparison operation such as ``cmp(a,b)`` would always produce an answer, "
"even if a user-defined :meth:`__cmp__` method encountered an error, since "
"the resulting exception would simply be silently swallowed."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:571
msgid ""
"Work has been done on porting Python to 64-bit Windows on the Itanium "
"processor, mostly by Trent Mick of ActiveState. (Confusingly, ``sys."
"platform`` is still ``'win32'`` on Win64 because it seems that for ease of "
"porting, MS Visual C++ treats code as 32 bit on Itanium.) PythonWin also "
"supports Windows CE; see the Python CE page at http://pythonce.sourceforge."
"net/ for more information."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:577
msgid ""
"Another new platform is Darwin/MacOS X; initial support for it is in Python "
"2.0. Dynamic loading works, if you specify \"configure --with-dyld --with-"
"suffix=.x\". Consult the README in the Python source distribution for more "
"instructions."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:581
msgid ""
"An attempt has been made to alleviate one of Python's warts, the often-"
"confusing :exc:`NameError` exception when code refers to a local variable "
"before the variable has been assigned a value. For example, the following "
"code raises an exception on the :keyword:`print` statement in both 1.5.2 and "
"2.0; in 1.5.2 a :exc:`NameError` exception is raised, while 2.0 raises a "
"new :exc:`UnboundLocalError` exception. :exc:`UnboundLocalError` is a "
"subclass of :exc:`NameError`, so any existing code that expects :exc:"
"`NameError` to be raised should still work. ::"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:595
msgid ""
"Two new exceptions, :exc:`TabError` and :exc:`IndentationError`, have been "
"introduced. They're both subclasses of :exc:`SyntaxError`, and are raised "
"when Python code is found to be improperly indented."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:601
msgid "Changes to Built-in Functions"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:603
msgid ""
"A new built-in, :func:`zip(seq1, seq2, ...)`, has been added. :func:`zip` "
"returns a list of tuples where each tuple contains the i-th element from "
"each of the argument sequences. The difference between :func:`zip` and "
"``map(None, seq1, seq2)`` is that :func:`map` pads the sequences with "
"``None`` if the sequences aren't all of the same length, while :func:`zip` "
"truncates the returned list to the length of the shortest argument sequence."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:610
msgid ""
"The :func:`int` and :func:`long` functions now accept an optional \"base\" "
"parameter when the first argument is a string. ``int('123', 10)`` returns "
"123, while ``int('123', 16)`` returns 291. ``int(123, 16)`` raises a :exc:"
"`TypeError` exception with the message \"can't convert non-string with "
"explicit base\"."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:616
msgid ""
"A new variable holding more detailed version information has been added to "
"the :mod:`sys` module. ``sys.version_info`` is a tuple ``(major, minor, "
"micro, level, serial)`` For example, in a hypothetical 2.0.1beta1, ``sys."
"version_info`` would be ``(2, 0, 1, 'beta', 1)``. *level* is a string such "
"as ``\"alpha\"``, ``\"beta\"``, or ``\"final\"`` for a final release."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:622
msgid ""
"Dictionaries have an odd new method, :meth:`setdefault(key, default)`, which "
"behaves similarly to the existing :meth:`get` method. However, if the key "
"is missing, :meth:`setdefault` both returns the value of *default* as :meth:"
"`get` would do, and also inserts it into the dictionary as the value for "
"*key*. Thus, the following lines of code::"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:633
msgid ""
"can be reduced to a single ``return dict.setdefault(key, [])`` statement."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:635
msgid ""
"The interpreter sets a maximum recursion depth in order to catch runaway "
"recursion before filling the C stack and causing a core dump or GPF.. "
"Previously this limit was fixed when you compiled Python, but in 2.0 the "
"maximum recursion depth can be read and modified using :func:`sys."
"getrecursionlimit` and :func:`sys.setrecursionlimit`. The default value is "
"1000, and a rough maximum value for a given platform can be found by running "
"a new script, :file:`Misc/find_recursionlimit.py`."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:647
msgid "Porting to 2.0"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:649
msgid ""
"New Python releases try hard to be compatible with previous releases, and "
"the record has been pretty good. However, some changes are considered "
"useful enough, usually because they fix initial design decisions that turned "
"out to be actively mistaken, that breaking backward compatibility can't "
"always be avoided. This section lists the changes in Python 2.0 that may "
"cause old Python code to break."
msgstr ""
# 97a8de02cb07493fbfa1a76d679dbdcc
#: ../src/Doc/whatsnew/2.0.rst:656
msgid ""
"The change which will probably break the most code is tightening up the "
"arguments accepted by some methods. Some methods would take multiple "
"arguments and treat them as a tuple, particularly various list methods such "
"as :meth:`append` and :meth:`insert`. In earlier versions of Python, if "
"``L`` is a list, ``L.append( 1,2 )`` appends the tuple ``(1,2)`` to the "
"list. In Python 2.0 this causes a :exc:`TypeError` exception to be raised, "
"with the message: 'append requires exactly 1 argument; 2 given'. The fix is "
"to simply add an extra set of parentheses to pass both values as a tuple: "
"``L.append( (1,2) )``."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:665
msgid ""
"The earlier versions of these methods were more forgiving because they used "
"an old function in Python's C interface to parse their arguments; 2.0 "
"modernizes them to use :func:`PyArg_ParseTuple`, the current argument "
"parsing function, which provides more helpful error messages and treats "
"multi-argument calls as errors. If you absolutely must use 2.0 but can't "
"fix your code, you can edit :file:`Objects/listobject.c` and define the "
"preprocessor symbol ``NO_STRICT_LIST_APPEND`` to preserve the old behaviour; "
"this isn't recommended."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:673
msgid ""
"Some of the functions in the :mod:`socket` module are still forgiving in "
"this way. For example, :func:`socket.connect( ('hostname', 25) )` is the "
"correct form, passing a tuple representing an IP address, but :func:`socket."
"connect( 'hostname', 25 )` also works. :func:`socket.connect_ex` and :func:"
"`socket.bind` are similarly easy-going. 2.0alpha1 tightened these functions "
"up, but because the documentation actually used the erroneous multiple "
"argument form, many people wrote code which would break with the stricter "
"checking. GvR backed out the changes in the face of public reaction, so for "
"the :mod:`socket` module, the documentation was fixed and the multiple "
"argument form is simply marked as deprecated; it *will* be tightened up "
"again in a future Python version."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:684
msgid ""
"The ``\\x`` escape in string literals now takes exactly 2 hex digits. "
"Previously it would consume all the hex digits following the 'x' and take "
"the lowest 8 bits of the result, so ``\\x123456`` was equivalent to ``"
"\\x56``."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:688
msgid ""
"The :exc:`AttributeError` and :exc:`NameError` exceptions have a more "
"friendly error message, whose text will be something like ``'Spam' instance "
"has no attribute 'eggs'`` or ``name 'eggs' is not defined``. Previously the "
"error message was just the missing attribute name ``eggs``, and code written "
"to take advantage of this fact will break in 2.0."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:694
msgid ""
"Some work has been done to make integers and long integers a bit more "
"interchangeable. In 1.5.2, large-file support was added for Solaris, to "
"allow reading files larger than 2 GiB; this made the :meth:`tell` method of "
"file objects return a long integer instead of a regular integer. Some code "
"would subtract two file offsets and attempt to use the result to multiply a "
"sequence or slice a string, but this raised a :exc:`TypeError`. In 2.0, "
"long integers can be used to multiply or slice a sequence, and it'll behave "
"as you'd intuitively expect it to; ``3L * 'abc'`` produces 'abcabcabc', and "
"``(0,1,2,3)[2L:4L]`` produces (2,3). Long integers can also be used in "
"various contexts where previously only integers were accepted, such as in "
"the :meth:`seek` method of file objects, and in the formats supported by the "
"``%`` operator (``%d``, ``%i``, ``%x``, etc.). For example, ``\"%d\" % "
"2L**64`` will produce the string ``18446744073709551616``."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:708
msgid ""
"The subtlest long integer change of all is that the :func:`str` of a long "
"integer no longer has a trailing 'L' character, though :func:`repr` still "
"includes it. The 'L' annoyed many people who wanted to print long integers "
"that looked just like regular integers, since they had to go out of their "
"way to chop off the character. This is no longer a problem in 2.0, but code "
"which does ``str(longval)[:-1]`` and assumes the 'L' is there, will now lose "
"the final digit."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:716
msgid ""
"Taking the :func:`repr` of a float now uses a different formatting precision "
"than :func:`str`. :func:`repr` uses ``%.17g`` format string for C's :func:"
"`sprintf`, while :func:`str` uses ``%.12g`` as before. The effect is that :"
"func:`repr` may occasionally show more decimal places than :func:`str`, for "
"certain numbers. For example, the number 8.1 can't be represented exactly "
"in binary, so ``repr(8.1)`` is ``'8.0999999999999996'``, while str(8.1) is "
"``'8.1'``."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:724
msgid ""
"The ``-X`` command-line option, which turned all standard exceptions into "
"strings instead of classes, has been removed; the standard exceptions will "
"now always be classes. The :mod:`exceptions` module containing the standard "
"exceptions was translated from Python to a built-in C module, written by "
"Barry Warsaw and Fredrik Lundh."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:740
msgid "Extending/Embedding Changes"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:742
msgid ""
"Some of the changes are under the covers, and will only be apparent to "
"people writing C extension modules or embedding a Python interpreter in a "
"larger application. If you aren't dealing with Python's C API, you can "
"safely skip this section."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:747
msgid ""
"The version number of the Python C API was incremented, so C extensions "
"compiled for 1.5.2 must be recompiled in order to work with 2.0. On "
"Windows, it's not possible for Python 2.0 to import a third party extension "
"built for Python 1.5.x due to how Windows DLLs work, so Python will raise an "
"exception and the import will fail."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:753
msgid ""
"Users of Jim Fulton's ExtensionClass module will be pleased to find out that "
"hooks have been added so that ExtensionClasses are now supported by :func:"
"`isinstance` and :func:`issubclass`. This means you no longer have to "
"remember to write code such as ``if type(obj) == myExtensionClass``, but can "
"use the more natural ``if isinstance(obj, myExtensionClass)``."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:759
msgid ""
"The :file:`Python/importdl.c` file, which was a mass of #ifdefs to support "
"dynamic loading on many different platforms, was cleaned up and reorganised "
"by Greg Stein. :file:`importdl.c` is now quite small, and platform-specific "
"code has been moved into a bunch of :file:`Python/dynload_\\*.c` files. "
"Another cleanup: there were also a number of :file:`my\\*.h` files in the "
"Include/ directory that held various portability hacks; they've been merged "
"into a single file, :file:`Include/pyport.h`."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:767
msgid ""
"Vladimir Marangozov's long-awaited malloc restructuring was completed, to "
"make it easy to have the Python interpreter use a custom allocator instead "
"of C's standard :func:`malloc`. For documentation, read the comments in :"
"file:`Include/pymem.h` and :file:`Include/objimpl.h`. For the lengthy "
"discussions during which the interface was hammered out, see the Web "
"archives of the 'patches' and 'python-dev' lists at python.org."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:774
msgid ""
"Recent versions of the GUSI development environment for MacOS support POSIX "
"threads. Therefore, Python's POSIX threading support now works on the "
"Macintosh. Threading support using the user-space GNU ``pth`` library was "
"also contributed."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:779
msgid ""
"Threading support on Windows was enhanced, too. Windows supports thread "
"locks that use kernel objects only in case of contention; in the common case "
"when there's no contention, they use simpler functions which are an order of "
"magnitude faster. A threaded version of Python 1.5.2 on NT is twice as slow "
"as an unthreaded version; with the 2.0 changes, the difference is only 10%. "
"These improvements were contributed by Yakov Markovitch."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:786
msgid ""
"Python 2.0's source now uses only ANSI C prototypes, so compiling Python now "
"requires an ANSI C compiler, and can no longer be done using a compiler that "
"only supports K&R C."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:790
msgid ""
"Previously the Python virtual machine used 16-bit numbers in its bytecode, "
"limiting the size of source files. In particular, this affected the maximum "
"size of literal lists and dictionaries in Python source; occasionally people "
"who are generating Python code would run into this limit. A patch by "
"Charles G. Waldman raises the limit from ``2^16`` to ``2^{32}``."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:796
msgid ""
"Three new convenience functions intended for adding constants to a module's "
"dictionary at module initialization time were added: :func:"
"`PyModule_AddObject`, :func:`PyModule_AddIntConstant`, and :func:"
"`PyModule_AddStringConstant`. Each of these functions takes a module "
"object, a null-terminated C string containing the name to be added, and a "
"third argument for the value to be assigned to the name. This third "
"argument is, respectively, a Python object, a C long, or a C string."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:804
msgid ""
"A wrapper API was added for Unix-style signal handlers. :func:`PyOS_getsig` "
"gets a signal handler and :func:`PyOS_setsig` will set a new handler."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:811
msgid "Distutils: Making Modules Easy to Install"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:813
msgid ""
"Before Python 2.0, installing modules was a tedious affair -- there was no "
"way to figure out automatically where Python is installed, or what compiler "
"options to use for extension modules. Software authors had to go through an "
"arduous ritual of editing Makefiles and configuration files, which only "
"really work on Unix and leave Windows and MacOS unsupported. Python users "
"faced wildly differing installation instructions which varied between "
"different extension packages, which made administering a Python installation "
"something of a chore."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:821
msgid ""
"The SIG for distribution utilities, shepherded by Greg Ward, has created the "
"Distutils, a system to make package installation much easier. They form "
"the :mod:`distutils` package, a new part of Python's standard library. In "
"the best case, installing a Python module from source will require the same "
"steps: first you simply mean unpack the tarball or zip archive, and the run "
"\"``python setup.py install``\". The platform will be automatically "
"detected, the compiler will be recognized, C extension modules will be "
"compiled, and the distribution installed into the proper directory. "
"Optional command-line arguments provide more control over the installation "
"process, the distutils package offers many places to override defaults -- "
"separating the build from the install, building or installing in non-default "
"directories, and more."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:833
msgid ""
"In order to use the Distutils, you need to write a :file:`setup.py` script. "
"For the simple case, when the software contains only .py files, a minimal :"
"file:`setup.py` can be just a few lines long::"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:841
msgid ""
"The :file:`setup.py` file isn't much more complicated if the software "
"consists of a few packages::"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:848
msgid ""
"A C extension can be the most complicated case; here's an example taken from "
"the PyXML package::"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:864
msgid ""
"The Distutils can also take care of creating source and binary "
"distributions. The \"sdist\" command, run by \"``python setup.py sdist``', "
"builds a source distribution such as :file:`foo-1.0.tar.gz`. Adding new "
"commands isn't difficult, \"bdist_rpm\" and \"bdist_wininst\" commands have "
"already been contributed to create an RPM distribution and a Windows "
"installer for the software, respectively. Commands to create other "
"distribution formats such as Debian packages and Solaris :file:`.pkg` files "
"are in various stages of development."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:873
msgid ""
"All this is documented in a new manual, *Distributing Python Modules*, that "
"joins the basic set of Python documentation."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:880
msgid "XML Modules"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:882
msgid ""
"Python 1.5.2 included a simple XML parser in the form of the :mod:`xmllib` "
"module, contributed by Sjoerd Mullender. Since 1.5.2's release, two "
"different interfaces for processing XML have become common: SAX2 (version 2 "
"of the Simple API for XML) provides an event-driven interface with some "
"similarities to :mod:`xmllib`, and the DOM (Document Object Model) provides "
"a tree-based interface, transforming an XML document into a tree of nodes "
"that can be traversed and modified. Python 2.0 includes a SAX2 interface "
"and a stripped- down DOM interface as part of the :mod:`xml` package. Here "
"we will give a brief overview of these new interfaces; consult the Python "
"documentation or the source code for complete details. The Python XML SIG is "
"also working on improved documentation."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:896
msgid "SAX2 Support"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:898
msgid ""
"SAX defines an event-driven interface for parsing XML. To use SAX, you must "
"write a SAX handler class. Handler classes inherit from various classes "
"provided by SAX, and override various methods that will then be called by "
"the XML parser. For example, the :meth:`startElement` and :meth:"
"`endElement` methods are called for every starting and end tag encountered "
"by the parser, the :meth:`characters` method is called for every chunk of "
"character data, and so forth."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:906
msgid ""
"The advantage of the event-driven approach is that the whole document "
"doesn't have to be resident in memory at any one time, which matters if you "
"are processing really huge documents. However, writing the SAX handler "
"class can get very complicated if you're trying to modify the document "
"structure in some elaborate way."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:912
msgid ""
"For example, this little example program defines a handler that prints a "
"message for every starting and ending tag, and then parses the file :file:"
"`hamlet.xml` using it::"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:935
msgid ""
"For more information, consult the Python documentation, or the XML HOWTO at "
"http://pyxml.sourceforge.net/topics/howto/xml-howto.html."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:940
msgid "DOM Support"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:942
msgid ""
"The Document Object Model is a tree-based representation for an XML "
"document. A top-level :class:`Document` instance is the root of the tree, "
"and has a single child which is the top-level :class:`Element` instance. "
"This :class:`Element` has children nodes representing character data and any "
"sub-elements, which may have further children of their own, and so forth. "
"Using the DOM you can traverse the resulting tree any way you like, access "
"element and attribute values, insert and delete nodes, and convert the tree "
"back into XML."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:950
msgid ""
"The DOM is useful for modifying XML documents, because you can create a DOM "
"tree, modify it by adding new nodes or rearranging subtrees, and then "
"produce a new XML document as output. You can also construct a DOM tree "
"manually and convert it to XML, which can be a more flexible way of "
"producing XML output than simply writing ``<tag1>``...\\ ``</tag1>`` to a "
"file."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:956
msgid ""
"The DOM implementation included with Python lives in the :mod:`xml.dom."
"minidom` module. It's a lightweight implementation of the Level 1 DOM with "
"support for XML namespaces. The :func:`parse` and :func:`parseString` "
"convenience functions are provided for generating a DOM tree::"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:964
msgid ""
"``doc`` is a :class:`Document` instance. :class:`Document`, like all the "
"other DOM classes such as :class:`Element` and :class:`Text`, is a subclass "
"of the :class:`Node` base class. All the nodes in a DOM tree therefore "
"support certain common methods, such as :meth:`toxml` which returns a string "
"containing the XML representation of the node and its children. Each class "
"also has special methods of its own; for example, :class:`Element` and :"
"class:`Document` instances have a method to find all child elements with a "
"given tag name. Continuing from the previous 2-line example::"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:977
msgid "For the *Hamlet* XML file, the above few lines output::"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:982
msgid ""
"The root element of the document is available as ``doc.documentElement``, "
"and its children can be easily modified by deleting, adding, or removing "
"nodes::"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:997
msgid ""
"Again, I will refer you to the Python documentation for a complete listing "
"of the different :class:`Node` classes and their various methods."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1002
msgid "Relationship to PyXML"
msgstr ""
# 0a379dc17e784e2a8ec0eac510412cb9
#: ../src/Doc/whatsnew/2.0.rst:1004
msgid ""
"The XML Special Interest Group has been working on XML-related Python code "
"for a while. Its code distribution, called PyXML, is available from the "
"SIG's Web pages at https://www.python.org/community/sigs/current/xml-sig. "
"The PyXML distribution also used the package name ``xml``. If you've "
"written programs that used PyXML, you're probably wondering about its "
"compatibility with the 2.0 :mod:`xml` package."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1010
msgid ""
"The answer is that Python 2.0's :mod:`xml` package isn't compatible with "
"PyXML, but can be made compatible by installing a recent version PyXML. "
"Many applications can get by with the XML support that is included with "
"Python 2.0, but more complicated applications will require that the full "
"PyXML package will be installed. When installed, PyXML versions 0.6.0 or "
"greater will replace the :mod:`xml` package shipped with Python, and will be "
"a strict superset of the standard package, adding a bunch of additional "
"features. Some of the additional features in PyXML include:"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1019
msgid "4DOM, a full DOM implementation from FourThought, Inc."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1021
msgid "The xmlproc validating parser, written by Lars Marius Garshol."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1023
msgid "The :mod:`sgmlop` parser accelerator module, written by Fredrik Lundh."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1029
msgid "Module changes"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1031
msgid ""
"Lots of improvements and bugfixes were made to Python's extensive standard "
"library; some of the affected modules include :mod:`readline`, :mod:"
"`ConfigParser`, :mod:`cgi`, :mod:`calendar`, :mod:`posix`, :mod:`readline`, :"
"mod:`xmllib`, :mod:`aifc`, :mod:`chunk, wave`, :mod:`random`, :mod:`shelve`, "
"and :mod:`nntplib`. Consult the CVS logs for the exact patch-by-patch "
"details."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1037
msgid ""
"Brian Gallew contributed OpenSSL support for the :mod:`socket` module. "
"OpenSSL is an implementation of the Secure Socket Layer, which encrypts the "
"data being sent over a socket. When compiling Python, you can edit :file:"
"`Modules/Setup` to include SSL support, which adds an additional function to "
"the :mod:`socket` module: :func:`socket.ssl(socket, keyfile, certfile)`, "
"which takes a socket object and returns an SSL socket. The :mod:`httplib` "
"and :mod:`urllib` modules were also changed to support ``https://`` URLs, "
"though no one has implemented FTP or SMTP over SSL."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1046
msgid ""
"The :mod:`httplib` module has been rewritten by Greg Stein to support "
"HTTP/1.1. Backward compatibility with the 1.5 version of :mod:`httplib` is "
"provided, though using HTTP/1.1 features such as pipelining will require "
"rewriting code to use a different set of interfaces."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1051
msgid ""
"The :mod:`Tkinter` module now supports Tcl/Tk version 8.1, 8.2, or 8.3, and "
"support for the older 7.x versions has been dropped. The Tkinter module now "
"supports displaying Unicode strings in Tk widgets. Also, Fredrik Lundh "
"contributed an optimization which makes operations like ``create_line`` and "
"``create_polygon`` much faster, especially when using lots of coordinates."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1057
msgid ""
"The :mod:`curses` module has been greatly extended, starting from Oliver "
"Andrich's enhanced version, to provide many additional functions from "
"ncurses and SYSV curses, such as colour, alternative character set support, "
"pads, and mouse support. This means the module is no longer compatible with "
"operating systems that only have BSD curses, but there don't seem to be any "
"currently maintained OSes that fall into this category."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1064
msgid ""
"As mentioned in the earlier discussion of 2.0's Unicode support, the "
"underlying implementation of the regular expressions provided by the :mod:"
"`re` module has been changed. SRE, a new regular expression engine written "
"by Fredrik Lundh and partially funded by Hewlett Packard, supports matching "
"against both 8-bit strings and Unicode strings."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1074
msgid "New modules"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1076
msgid ""
"A number of new modules were added. We'll simply list them with brief "
"descriptions; consult the 2.0 documentation for the details of a particular "
"module."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1080
msgid ""
":mod:`atexit`: For registering functions to be called before the Python "
"interpreter exits. Code that currently sets ``sys.exitfunc`` directly should "
"be changed to use the :mod:`atexit` module instead, importing :mod:`atexit` "
"and calling :func:`atexit.register` with the function to be called on exit. "
"(Contributed by Skip Montanaro.)"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1086
msgid ""
":mod:`codecs`, :mod:`encodings`, :mod:`unicodedata`: Added as part of the "
"new Unicode support."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1089
msgid ""
":mod:`filecmp`: Supersedes the old :mod:`cmp`, :mod:`cmpcache` and :mod:"
"`dircmp` modules, which have now become deprecated. (Contributed by Gordon "
"MacMillan and Moshe Zadka.)"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1093
msgid ""
":mod:`gettext`: This module provides internationalization (I18N) and "
"localization (L10N) support for Python programs by providing an interface to "
"the GNU gettext message catalog library. (Integrated by Barry Warsaw, from "
"separate contributions by Martin von Löwis, Peter Funk, and James "
"Henstridge.)"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1098
msgid ""
":mod:`linuxaudiodev`: Support for the :file:`/dev/audio` device on Linux, a "
"twin to the existing :mod:`sunaudiodev` module. (Contributed by Peter Bosch, "
"with fixes by Jeremy Hylton.)"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1102
msgid ""
":mod:`mmap`: An interface to memory-mapped files on both Windows and Unix. "
"A file's contents can be mapped directly into memory, at which point it "
"behaves like a mutable string, so its contents can be read and modified. "
"They can even be passed to functions that expect ordinary strings, such as "
"the :mod:`re` module. (Contributed by Sam Rushing, with some extensions by A."
"M. Kuchling.)"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1108
msgid ""
":mod:`pyexpat`: An interface to the Expat XML parser. (Contributed by Paul "
"Prescod.)"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1111
msgid ""
":mod:`robotparser`: Parse a :file:`robots.txt` file, which is used for "
"writing Web spiders that politely avoid certain areas of a Web site. The "
"parser accepts the contents of a :file:`robots.txt` file, builds a set of "
"rules from it, and can then answer questions about the fetchability of a "
"given URL. (Contributed by Skip Montanaro.)"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1117
msgid ""
":mod:`tabnanny`: A module/script to check Python source code for ambiguous "
"indentation. (Contributed by Tim Peters.)"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1120
msgid ""
":mod:`UserString`: A base class useful for deriving objects that behave like "
"strings."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1123
msgid ""
":mod:`webbrowser`: A module that provides a platform independent way to "
"launch a web browser on a specific URL. For each platform, various browsers "
"are tried in a specific order. The user can alter which browser is launched "
"by setting the *BROWSER* environment variable. (Originally inspired by Eric "
"S. Raymond's patch to :mod:`urllib` which added similar functionality, but "
"the final module comes from code originally implemented by Fred Drake as :"
"file:`Tools/idle/BrowserControl.py`, and adapted for the standard library by "
"Fred.)"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1132
msgid ""
":mod:`_winreg`: An interface to the Windows registry. :mod:`_winreg` is an "
"adaptation of functions that have been part of PythonWin since 1995, but has "
"now been added to the core distribution, and enhanced to support Unicode. :"
"mod:`_winreg` was written by Bill Tutt and Mark Hammond."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1137
msgid ""
":mod:`zipfile`: A module for reading and writing ZIP-format archives. These "
"are archives produced by :program:`PKZIP` on DOS/Windows or :program:`zip` "
"on Unix, not to be confused with :program:`gzip`\\ -format files (which are "
"supported by the :mod:`gzip` module) (Contributed by James C. Ahlstrom.)"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1142
msgid ""
":mod:`imputil`: A module that provides a simpler way for writing customised "
"import hooks, in comparison to the existing :mod:`ihooks` module. "
"(Implemented by Greg Stein, with much discussion on python-dev along the "
"way.)"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1150
msgid "IDLE Improvements"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1152
msgid ""
"IDLE is the official Python cross-platform IDE, written using Tkinter. "
"Python 2.0 includes IDLE 0.6, which adds a number of new features and "
"improvements. A partial list:"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1156
msgid ""
"UI improvements and optimizations, especially in the area of syntax "
"highlighting and auto-indentation."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1159
msgid ""
"The class browser now shows more information, such as the top level "
"functions in a module."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1162
msgid ""
"Tab width is now a user settable option. When opening an existing Python "
"file, IDLE automatically detects the indentation conventions, and adapts."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1165
msgid ""
"There is now support for calling browsers on various platforms, used to open "
"the Python documentation in a browser."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1168
msgid ""
"IDLE now has a command line, which is largely similar to the vanilla Python "
"interpreter."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1171
msgid "Call tips were added in many places."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1173
msgid "IDLE can now be installed as a package."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1175
msgid "In the editor window, there is now a line/column bar at the bottom."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1177
msgid ""
"Three new keystroke commands: Check module (Alt-F5), Import module (F5) and "
"Run script (Ctrl-F5)."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1184
msgid "Deleted and Deprecated Modules"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1186
msgid ""
"A few modules have been dropped because they're obsolete, or because there "
"are now better ways to do the same thing. The :mod:`stdwin` module is gone; "
"it was for a platform-independent windowing toolkit that's no longer "
"developed."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1190
msgid ""
"A number of modules have been moved to the :file:`lib-old` subdirectory: :"
"mod:`cmp`, :mod:`cmpcache`, :mod:`dircmp`, :mod:`dump`, :mod:`find`, :mod:"
"`grep`, :mod:`packmail`, :mod:`poly`, :mod:`util`, :mod:`whatsound`, :mod:"
"`zmod`. If you have code which relies on a module that's been moved to :"
"file:`lib-old`, you can simply add that directory to ``sys.path`` to get "
"them back, but you're encouraged to update any code that uses these modules."
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1199 ../src/Doc/whatsnew/2.1.rst:789
#: ../src/Doc/whatsnew/2.2.rst:1260 ../src/Doc/whatsnew/2.3.rst:2071
#: ../src/Doc/whatsnew/2.4.rst:1557 ../src/Doc/whatsnew/2.5.rst:2280
#: ../src/Doc/whatsnew/2.6.rst:3304 ../src/Doc/whatsnew/2.7.rst:2650
msgid "Acknowledgements"
msgstr ""
#: ../src/Doc/whatsnew/2.0.rst:1201
msgid ""
"The authors would like to thank the following people for offering "
"suggestions on various drafts of this article: David Bolen, Mark Hammond, "
"Gregg Hauser, Jeremy Hylton, Fredrik Lundh, Detlef Lannert, Aahz Maruch, "
"Skip Montanaro, Vladimir Marangozov, Tobias Polzin, Guido van Rossum, Neil "
"Schemenauer, and Russ Schmidt."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:3
msgid "What's New in Python 2.1"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:5 ../src/Doc/whatsnew/2.2.rst:5
#: ../src/Doc/whatsnew/2.3.rst:5 ../src/Doc/whatsnew/2.4.rst:5
#: ../src/Doc/whatsnew/2.5.rst:5
msgid "A.M. Kuchling"
msgstr "A.M. Kuchling"
#: ../src/Doc/whatsnew/2.1.rst:15
msgid ""
"This article explains the new features in Python 2.1. While there aren't as "
"many changes in 2.1 as there were in Python 2.0, there are still some "
"pleasant surprises in store. 2.1 is the first release to be steered through "
"the use of Python Enhancement Proposals, or PEPs, so most of the sizable "
"changes have accompanying PEPs that provide more complete documentation and "
"a design rationale for the change. This article doesn't attempt to document "
"the new features completely, but simply provides an overview of the new "
"features for Python programmers. Refer to the Python 2.1 documentation, or "
"to the specific PEP, for more details about any new feature that "
"particularly interests you."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:25
msgid ""
"One recent goal of the Python development team has been to accelerate the "
"pace of new releases, with a new release coming every 6 to 9 months. 2.1 is "
"the first release to come out at this faster pace, with the first alpha "
"appearing in January, 3 months after the final version of 2.0 was released."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:30
msgid "The final release of Python 2.1 was made on April 17, 2001."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:36 ../src/Doc/whatsnew/2.2.rst:839
msgid "PEP 227: Nested Scopes"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:38
msgid ""
"The largest change in Python 2.1 is to Python's scoping rules. In Python "
"2.0, at any given time there are at most three namespaces used to look up "
"variable names: local, module-level, and the built-in namespace. This often "
"surprised people because it didn't match their intuitive expectations. For "
"example, a nested recursive function definition doesn't work::"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:51 ../src/Doc/whatsnew/2.2.rst:862
msgid ""
"The function :func:`g` will always raise a :exc:`NameError` exception, "
"because the binding of the name ``g`` isn't in either its local namespace or "
"in the module-level namespace. This isn't much of a problem in practice "
"(how often do you recursively define interior functions like this?), but "
"this also made using the :keyword:`lambda` statement clumsier, and this was "
"a problem in practice. In code which uses :keyword:`lambda` you can often "
"find local variables being copied by passing them as the default values of "
"arguments. ::"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:65 ../src/Doc/whatsnew/2.2.rst:876
msgid ""
"The readability of Python code written in a strongly functional style "
"suffers greatly as a result."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:68
msgid ""
"The most significant change to Python 2.1 is that static scoping has been "
"added to the language to fix this problem. As a first effect, the "
"``name=name`` default argument is now unnecessary in the above example. Put "
"simply, when a given variable name is not assigned a value within a function "
"(by an assignment, or the :keyword:`def`, :keyword:`class`, or :keyword:"
"`import` statements), references to the variable will be looked up in the "
"local namespace of the enclosing scope. A more detailed explanation of the "
"rules, and a dissection of the implementation, can be found in the PEP."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:77 ../src/Doc/whatsnew/2.2.rst:888
msgid ""
"This change may cause some compatibility problems for code where the same "
"variable name is used both at the module level and as a local variable "
"within a function that contains further function definitions. This seems "
"rather unlikely though, since such code would have been pretty confusing to "
"read in the first place."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:83 ../src/Doc/whatsnew/2.2.rst:894
msgid ""
"One side effect of the change is that the ``from module import *`` and :"
"keyword:`exec` statements have been made illegal inside a function scope "
"under certain conditions. The Python reference manual has said all along "
"that ``from module import *`` is only legal at the top level of a module, "
"but the CPython interpreter has never enforced this before. As part of the "
"implementation of nested scopes, the compiler which turns Python source into "
"bytecodes has to generate different code to access variables in a containing "
"scope. ``from module import *`` and :keyword:`exec` make it impossible for "
"the compiler to figure this out, because they add names to the local "
"namespace that are unknowable at compile time. Therefore, if a function "
"contains function definitions or :keyword:`lambda` expressions with free "
"variables, the compiler will flag this by raising a :exc:`SyntaxError` "
"exception."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:96 ../src/Doc/whatsnew/2.2.rst:907
msgid "To make the preceding explanation a bit clearer, here's an example::"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:105 ../src/Doc/whatsnew/2.2.rst:916
msgid ""
"Line 4 containing the :keyword:`exec` statement is a syntax error, since :"
"keyword:`exec` would define a new local variable named ``x`` whose value "
"should be accessed by :func:`g`."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:109 ../src/Doc/whatsnew/2.2.rst:920
msgid ""
"This shouldn't be much of a limitation, since :keyword:`exec` is rarely used "
"in most Python code (and when it is used, it's often a sign of a poor design "
"anyway)."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:113
msgid ""
"Compatibility concerns have led to nested scopes being introduced gradually; "
"in Python 2.1, they aren't enabled by default, but can be turned on within a "
"module by using a future statement as described in PEP 236. (See the "
"following section for further discussion of PEP 236.) In Python 2.2, nested "
"scopes will become the default and there will be no way to turn them off, "
"but users will have had all of 2.1's lifetime to fix any breakage resulting "
"from their introduction."
msgstr ""
# d027fc4aa5274049bf8ac7f82f843e9d
# 586aceac72fb40a0b26bce3d05a1e413
#: ../src/Doc/whatsnew/2.1.rst:122 ../src/Doc/whatsnew/2.2.rst:926
msgid ":pep:`227` - Statically Nested Scopes"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:124 ../src/Doc/whatsnew/2.2.rst:928
msgid "Written and implemented by Jeremy Hylton."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:130
msgid "PEP 236: __future__ Directives"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:132
msgid ""
"The reaction to nested scopes was widespread concern about the dangers of "
"breaking code with the 2.1 release, and it was strong enough to make the "
"Pythoneers take a more conservative approach. This approach consists of "
"introducing a convention for enabling optional functionality in release N "
"that will become compulsory in release N+1."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:138
msgid ""
"The syntax uses a ``from...import`` statement using the reserved module "
"name :mod:`__future__`. Nested scopes can be enabled by the following "
"statement::"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:143
msgid ""
"While it looks like a normal :keyword:`import` statement, it's not; there "
"are strict rules on where such a future statement can be put. They can only "
"be at the top of a module, and must precede any Python code or regular :"
"keyword:`import` statements. This is because such statements can affect how "
"the Python bytecode compiler parses code and generates bytecode, so they "
"must precede any statement that will result in bytecodes being produced."
msgstr ""
# 0ac3098651244dd4aa121ea4368c926b
#: ../src/Doc/whatsnew/2.1.rst:152
msgid ":pep:`236` - Back to the :mod:`__future__`"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:154
msgid "Written by Tim Peters, and primarily implemented by Jeremy Hylton."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:160
msgid "PEP 207: Rich Comparisons"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:162
msgid ""
"In earlier versions, Python's support for implementing comparisons on user- "
"defined classes and extension types was quite simple. Classes could "
"implement a :meth:`__cmp__` method that was given two instances of a class, "
"and could only return 0 if they were equal or +1 or -1 if they weren't; the "
"method couldn't raise an exception or return anything other than a Boolean "
"value. Users of Numeric Python often found this model too weak and "
"restrictive, because in the number-crunching programs that numeric Python is "
"used for, it would be more useful to be able to perform elementwise "
"comparisons of two matrices, returning a matrix containing the results of a "
"given comparison for each element. If the two matrices are of different "
"sizes, then the compare has to be able to raise an exception to signal the "
"error."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:174
msgid ""
"In Python 2.1, rich comparisons were added in order to support this need. "
"Python classes can now individually overload each of the ``<``, ``<=``, "
"``>``, ``>=``, ``==``, and ``!=`` operations. The new magic method names "
"are:"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:179 ../src/Doc/whatsnew/2.5.rst:1807
msgid "Operation"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:179
msgid "Method name"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:181
msgid "``<``"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:181
msgid ":meth:`__lt__`"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:183
msgid "``<=``"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:183
msgid ":meth:`__le__`"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:185
msgid "``>``"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:185
msgid ":meth:`__gt__`"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:187
msgid "``>=``"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:187
msgid ":meth:`__ge__`"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:189
msgid "``==``"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:189
msgid ":meth:`__eq__`"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:191
msgid "``!=``"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:191
msgid ":meth:`__ne__`"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:194
msgid ""
"(The magic methods are named after the corresponding Fortran operators ``.LT."
"``. ``.LE.``, &c. Numeric programmers are almost certainly quite familiar "
"with these names and will find them easy to remember.)"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:198
msgid ""
"Each of these magic methods is of the form ``method(self, other)``, where "
"``self`` will be the object on the left-hand side of the operator, while "
"``other`` will be the object on the right-hand side. For example, the "
"expression ``A < B`` will cause ``A.__lt__(B)`` to be called."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:203
msgid ""
"Each of these magic methods can return anything at all: a Boolean, a matrix, "
"a list, or any other Python object. Alternatively they can raise an "
"exception if the comparison is impossible, inconsistent, or otherwise "
"meaningless."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:207
msgid ""
"The built-in :func:`cmp(A,B)` function can use the rich comparison "
"machinery, and now accepts an optional argument specifying which comparison "
"operation to use; this is given as one of the strings ``\"<\"``, ``\"<=\"``, "
"``\">\"``, ``\">=\"``, ``\"==\"``, or ``\"!=\"``. If called without the "
"optional third argument, :func:`cmp` will only return -1, 0, or +1 as in "
"previous versions of Python; otherwise it will call the appropriate method "
"and can return any Python object."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:214
msgid ""
"There are also corresponding changes of interest to C programmers; there's a "
"new slot ``tp_richcmp`` in type objects and an API for performing a given "
"rich comparison. I won't cover the C API here, but will refer you to PEP "
"207, or to 2.1's C API documentation, for the full list of related functions."
msgstr ""
# 8310c515b99d402493662d62d2ffd48a
#: ../src/Doc/whatsnew/2.1.rst:222
msgid ":pep:`207` - Rich Comparisions"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:223
msgid ""
"Written by Guido van Rossum, heavily based on earlier work by David Ascher, "
"and implemented by Guido van Rossum."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:230
msgid "PEP 230: Warning Framework"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:232
msgid ""
"Over its 10 years of existence, Python has accumulated a certain number of "
"obsolete modules and features along the way. It's difficult to know when a "
"feature is safe to remove, since there's no way of knowing how much code "
"uses it --- perhaps no programs depend on the feature, or perhaps many do. "
"To enable removing old features in a more structured way, a warning "
"framework was added. When the Python developers want to get rid of a "
"feature, it will first trigger a warning in the next version of Python. The "
"following Python version can then drop the feature, and users will have had "
"a full release cycle to remove uses of the old feature."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:242
msgid ""
"Python 2.1 adds the warning framework to be used in this scheme. It adds a :"
"mod:`warnings` module that provide functions to issue warnings, and to "
"filter out warnings that you don't want to be displayed. Third-party modules "
"can also use this framework to deprecate old features that they no longer "
"wish to support."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:248
msgid ""
"For example, in Python 2.1 the :mod:`regex` module is deprecated, so "
"importing it causes a warning to be printed::"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:256
msgid "Warnings can be issued by calling the :func:`warnings.warn` function::"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:260
msgid ""
"The first parameter is the warning message; an additional optional "
"parameters can be used to specify a particular warning category."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:263
msgid ""
"Filters can be added to disable certain warnings; a regular expression "
"pattern can be applied to the message or to the module name in order to "
"suppress a warning. For example, you may have a program that uses the :mod:"
"`regex` module and not want to spare the time to convert it to use the :mod:"
"`re` module right now. The warning can be suppressed by calling ::"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:275
msgid ""
"This adds a filter that will apply only to warnings of the class :class:"
"`DeprecationWarning` triggered in the :mod:`__main__` module, and applies a "
"regular expression to only match the message about the :mod:`regex` module "
"being deprecated, and will cause such warnings to be ignored. Warnings can "
"also be printed only once, printed every time the offending code is "
"executed, or turned into exceptions that will cause the program to stop "
"(unless the exceptions are caught in the usual way, of course)."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:283
msgid ""
"Functions were also added to Python's C API for issuing warnings; refer to "
"PEP 230 or to Python's API documentation for the details."
msgstr ""
# 2a808a0c1b544575af469cd78f9c1a6c
#: ../src/Doc/whatsnew/2.1.rst:292
msgid ":pep:`5` - Guidelines for Language Evolution"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:290
msgid ""
"Written by Paul Prescod, to specify procedures to be followed when removing "
"old features from Python. The policy described in this PEP hasn't been "
"officially adopted, but the eventual policy probably won't be too different "
"from Prescod's proposal."
msgstr ""
# 0a8b0defb9e54319bc7e4d67f38bf092
#: ../src/Doc/whatsnew/2.1.rst:294
msgid ":pep:`230` - Warning Framework"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:296
msgid "Written and implemented by Guido van Rossum."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:302
msgid "PEP 229: New Build System"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:304
msgid ""
"When compiling Python, the user had to go in and edit the :file:`Modules/"
"Setup` file in order to enable various additional modules; the default set "
"is relatively small and limited to modules that compile on most Unix "
"platforms. This means that on Unix platforms with many more features, most "
"notably Linux, Python installations often don't contain all useful modules "
"they could."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:310
msgid ""
"Python 2.0 added the Distutils, a set of modules for distributing and "
"installing extensions. In Python 2.1, the Distutils are used to compile "
"much of the standard library of extension modules, autodetecting which ones "
"are supported on the current machine. It's hoped that this will make Python "
"installations easier and more featureful."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:316
msgid ""
"Instead of having to edit the :file:`Modules/Setup` file in order to enable "
"modules, a :file:`setup.py` script in the top directory of the Python source "
"distribution is run at build time, and attempts to discover which modules "
"can be enabled by examining the modules and header files on the system. If "
"a module is configured in :file:`Modules/Setup`, the :file:`setup.py` script "
"won't attempt to compile that module and will defer to the :file:`Modules/"
"Setup` file's contents. This provides a way to specific any strange command-"
"line flags or libraries that are required for a specific platform."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:325
msgid ""
"In another far-reaching change to the build mechanism, Neil Schemenauer "
"restructured things so Python now uses a single makefile that isn't "
"recursive, instead of makefiles in the top directory and in each of the :"
"file:`Python/`, :file:`Parser/`, :file:`Objects/`, and :file:`Modules/` "
"subdirectories. This makes building Python faster and also makes hacking "
"the Makefiles clearer and simpler."
msgstr ""
# 97d05992caf3405e8e22b9c1cb54a2e6
#: ../src/Doc/whatsnew/2.1.rst:334
msgid ":pep:`229` - Using Distutils to Build Python"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:336 ../src/Doc/whatsnew/2.1.rst:571
msgid "Written and implemented by A.M. Kuchling."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:342
msgid "PEP 205: Weak References"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:344
msgid ""
"Weak references, available through the :mod:`weakref` module, are a minor "
"but useful new data type in the Python programmer's toolbox."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:347
msgid ""
"Storing a reference to an object (say, in a dictionary or a list) has the "
"side effect of keeping that object alive forever. There are a few specific "
"cases where this behaviour is undesirable, object caches being the most "
"common one, and another being circular references in data structures such as "
"trees."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:352
msgid ""
"For example, consider a memoizing function that caches the results of "
"another function :func:`f(x)` by storing the function's argument and its "
"result in a dictionary::"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:368
msgid ""
"This version works for simple things such as integers, but it has a side "
"effect; the ``_cache`` dictionary holds a reference to the return values, so "
"they'll never be deallocated until the Python process exits and cleans up "
"This isn't very noticeable for integers, but if :func:`f` returns an object, "
"or a data structure that takes up a lot of memory, this can be a problem."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:374
msgid ""
"Weak references provide a way to implement a cache that won't keep objects "
"alive beyond their time. If an object is only accessible through weak "
"references, the object will be deallocated and the weak references will now "
"indicate that the object it referred to no longer exists. A weak reference "
"to an object *obj* is created by calling ``wr = weakref.ref(obj)``. The "
"object being referred to is returned by calling the weak reference as if it "
"were a function: ``wr()``. It will return the referenced object, or "
"``None`` if the object no longer exists."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:382
msgid ""
"This makes it possible to write a :func:`memoize` function whose cache "
"doesn't keep objects alive, by storing weak references in the cache. ::"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:400
msgid ""
"The :mod:`weakref` module also allows creating proxy objects which behave "
"like weak references --- an object referenced only by proxy objects is "
"deallocated -- but instead of requiring an explicit call to retrieve the "
"object, the proxy transparently forwards all operations to the object as "
"long as the object still exists. If the object is deallocated, attempting "
"to use a proxy will cause a :exc:`weakref.ReferenceError` exception to be "
"raised. ::"
msgstr ""
# e57485a7360c4b1988dbe9bdee02146c
#: ../src/Doc/whatsnew/2.1.rst:415
msgid ":pep:`205` - Weak References"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:417
msgid "Written and implemented by Fred L. Drake, Jr."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:423
msgid "PEP 232: Function Attributes"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:425
msgid ""
"In Python 2.1, functions can now have arbitrary information attached to "
"them. People were often using docstrings to hold information about functions "
"and methods, because the ``__doc__`` attribute was the only way of attaching "
"any information to a function. For example, in the Zope Web application "
"server, functions are marked as safe for public access by having a "
"docstring, and in John Aycock's SPARK parsing framework, docstrings hold "
"parts of the BNF grammar to be parsed. This overloading is unfortunate, "
"since docstrings are really intended to hold a function's documentation; for "
"example, it means you can't properly document functions intended for private "
"use in Zope."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:435
msgid ""
"Arbitrary attributes can now be set and retrieved on functions using the "
"regular Python syntax::"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:444
msgid ""
"The dictionary containing attributes can be accessed as the function's :attr:"
"`__dict__`. Unlike the :attr:`__dict__` attribute of class instances, in "
"functions you can actually assign a new dictionary to :attr:`__dict__`, "
"though the new value is restricted to a regular Python dictionary; you "
"*can't* be tricky and set it to a :class:`UserDict` instance, or any other "
"random object that behaves like a mapping."
msgstr ""
# 8abd0713478b4753b8dff0432d4e5223
#: ../src/Doc/whatsnew/2.1.rst:453
msgid ":pep:`232` - Function Attributes"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:455
msgid "Written and implemented by Barry Warsaw."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:461
msgid "PEP 235: Importing Modules on Case-Insensitive Platforms"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:463
msgid ""
"Some operating systems have filesystems that are case-insensitive, MacOS and "
"Windows being the primary examples; on these systems, it's impossible to "
"distinguish the filenames ``FILE.PY`` and ``file.py``, even though they do "
"store the file's name in its original case (they're case-preserving, too)."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:468
msgid ""
"In Python 2.1, the :keyword:`import` statement will work to simulate case- "
"sensitivity on case-insensitive platforms. Python will now search for the "
"first case-sensitive match by default, raising an :exc:`ImportError` if no "
"such file is found, so ``import file`` will not import a module named ``FILE."
"PY``. Case- insensitive matching can be requested by setting the :envvar:"
"`PYTHONCASEOK` environment variable before starting the Python interpreter."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:479
msgid "PEP 217: Interactive Display Hook"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:481
msgid ""
"When using the Python interpreter interactively, the output of commands is "
"displayed using the built-in :func:`repr` function. In Python 2.1, the "
"variable :func:`sys.displayhook` can be set to a callable object which will "
"be called instead of :func:`repr`. For example, you can set it to a special "
"pretty- printing function::"
msgstr ""
# 3c6ec165a4d54f67bfdee682e60a4032
#: ../src/Doc/whatsnew/2.1.rst:501
msgid ":pep:`217` - Display Hook for Interactive Use"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:503
msgid "Written and implemented by Moshe Zadka."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:509
msgid "PEP 208: New Coercion Model"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:511
msgid ""
"How numeric coercion is done at the C level was significantly modified. "
"This will only affect the authors of C extensions to Python, allowing them "
"more flexibility in writing extension types that support numeric operations."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:515
msgid ""
"Extension types can now set the type flag ``Py_TPFLAGS_CHECKTYPES`` in their "
"``PyTypeObject`` structure to indicate that they support the new coercion "
"model. In such extension types, the numeric slot functions can no longer "
"assume that they'll be passed two arguments of the same type; instead they "
"may be passed two arguments of differing types, and can then perform their "
"own internal coercion. If the slot function is passed a type it can't "
"handle, it can indicate the failure by returning a reference to the "
"``Py_NotImplemented`` singleton value. The numeric functions of the other "
"type will then be tried, and perhaps they can handle the operation; if the "
"other type also returns ``Py_NotImplemented``, then a :exc:`TypeError` will "
"be raised. Numeric methods written in Python can also return "
"``Py_NotImplemented``, causing the interpreter to act as if the method did "
"not exist (perhaps raising a :exc:`TypeError`, perhaps trying another "
"object's numeric methods)."
msgstr ""
# 55dd10f8b92646df8432f31d16a1bd95
#: ../src/Doc/whatsnew/2.1.rst:533
msgid ":pep:`208` - Reworking the Coercion Model"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:533
msgid ""
"Written and implemented by Neil Schemenauer, heavily based upon earlier work "
"by Marc-André Lemburg. Read this to understand the fine points of how "
"numeric operations will now be processed at the C level."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:541
msgid "PEP 241: Metadata in Python Packages"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:543
msgid ""
"A common complaint from Python users is that there's no single catalog of "
"all the Python modules in existence. T. Middleton's Vaults of Parnassus at "
"http://www.vex.net/parnassus/ are the largest catalog of Python modules, but "
"registering software at the Vaults is optional, and many people don't bother."
msgstr ""
# fd8cede95806481994f69e5938903c0f
#: ../src/Doc/whatsnew/2.1.rst:548
msgid ""
"As a first small step toward fixing the problem, Python software packaged "
"using the Distutils :command:`sdist` command will include a file named :file:"
"`PKG-INFO` containing information about the package such as its name, "
"version, and author (metadata, in cataloguing terminology). PEP 241 "
"contains the full list of fields that can be present in the :file:`PKG-INFO` "
"file. As people began to package their software using Python 2.1, more and "
"more packages will include metadata, making it possible to build automated "
"cataloguing systems and experiment with them. With the result experience, "
"perhaps it'll be possible to design a really good catalog and then build "
"support for it into Python 2.2. For example, the Distutils :command:`sdist` "
"and :command:`bdist_\\*` commands could support a ``upload`` option that "
"would automatically upload your package to a catalog server."
msgstr ""
# 73c046415e98401db54db638886142aa
#: ../src/Doc/whatsnew/2.1.rst:561
msgid ""
"You can start creating packages containing :file:`PKG-INFO` even if you're "
"not using Python 2.1, since a new release of the Distutils will be made for "
"users of earlier Python versions. Version 1.0.2 of the Distutils includes "
"the changes described in PEP 241, as well as various bugfixes and "
"enhancements. It will be available from the Distutils SIG at https://www."
"python.org/sigs/distutils-sig/."
msgstr ""
# 5c6f99707ecf4ea09ea3795b6ec4f0ed
#: ../src/Doc/whatsnew/2.1.rst:570
msgid ":pep:`241` - Metadata for Python Software Packages"
msgstr ""
# 35ca7fdd774e4d5d85332286b60a232d
#: ../src/Doc/whatsnew/2.1.rst:573
msgid ":pep:`243` - Module Repository Upload Mechanism"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:574
msgid ""
"Written by Sean Reifschneider, this draft PEP describes a proposed mechanism "
"for uploading Python packages to a central server."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:581 ../src/Doc/whatsnew/2.2.rst:934
#: ../src/Doc/whatsnew/2.6.rst:1779 ../src/Doc/whatsnew/2.7.rst:1010
msgid "New and Improved Modules"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:583
msgid ""
"Ka-Ping Yee contributed two new modules: :mod:`inspect.py`, a module for "
"getting information about live Python code, and :mod:`pydoc.py`, a module "
"for interactively converting docstrings to HTML or text. As a bonus, :file:"
"`Tools/scripts/pydoc`, which is now automatically installed, uses :mod:"
"`pydoc.py` to display documentation given a Python module, package, or class "
"name. For example, ``pydoc xml.dom`` displays the following::"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:605
msgid ""
":file:`pydoc` also includes a Tk-based interactive help browser. :file:"
"`pydoc` quickly becomes addictive; try it out!"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:608
msgid ""
"Two different modules for unit testing were added to the standard library. "
"The :mod:`doctest` module, contributed by Tim Peters, provides a testing "
"framework based on running embedded examples in docstrings and comparing the "
"results against the expected output. PyUnit, contributed by Steve Purcell, "
"is a unit testing framework inspired by JUnit, which was in turn an "
"adaptation of Kent Beck's Smalltalk testing framework. See http://pyunit."
"sourceforge.net/ for more information about PyUnit."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:616
msgid ""
"The :mod:`difflib` module contains a class, :class:`SequenceMatcher`, which "
"compares two sequences and computes the changes required to transform one "
"sequence into the other. For example, this module can be used to write a "
"tool similar to the Unix :program:`diff` program, and in fact the sample "
"program :file:`Tools/scripts/ndiff.py` demonstrates how to write such a "
"script."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:622
msgid ""
":mod:`curses.panel`, a wrapper for the panel library, part of ncurses and of "
"SYSV curses, was contributed by Thomas Gellekum. The panel library provides "
"windows with the additional feature of depth. Windows can be moved higher or "
"lower in the depth ordering, and the panel library figures out where panels "
"overlap and which sections are visible."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:628
msgid ""
"The PyXML package has gone through a few releases since Python 2.0, and "
"Python 2.1 includes an updated version of the :mod:`xml` package. Some of "
"the noteworthy changes include support for Expat 1.2 and later versions, the "
"ability for Expat parsers to handle files in any encoding supported by "
"Python, and various bugfixes for SAX, DOM, and the :mod:`minidom` module."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:634
msgid ""
"Ping also contributed another hook for handling uncaught exceptions. :func:"
"`sys.excepthook` can be set to a callable object. When an exception isn't "
"caught by any :keyword:`try`...\\ :keyword:`except` blocks, the exception "
"will be passed to :func:`sys.excepthook`, which can then do whatever it "
"likes. At the Ninth Python Conference, Ping demonstrated an application for "
"this hook: printing an extended traceback that not only lists the stack "
"frames, but also lists the function arguments and the local variables for "
"each frame."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:642
msgid ""
"Various functions in the :mod:`time` module, such as :func:`asctime` and :"
"func:`localtime`, require a floating point argument containing the time in "
"seconds since the epoch. The most common use of these functions is to work "
"with the current time, so the floating point argument has been made "
"optional; when a value isn't provided, the current time will be used. For "
"example, log file entries usually need a string containing the current time; "
"in Python 2.1, ``time.asctime()`` can be used, instead of the lengthier "
"``time.asctime(time.localtime(time.time()))`` that was previously required."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:651
msgid "This change was proposed and implemented by Thomas Wouters."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:653
msgid ""
"The :mod:`ftplib` module now defaults to retrieving files in passive mode, "
"because passive mode is more likely to work from behind a firewall. This "
"request came from the Debian bug tracking system, since other Debian "
"packages use :mod:`ftplib` to retrieve files and then don't work from behind "
"a firewall. It's deemed unlikely that this will cause problems for anyone, "
"because Netscape defaults to passive mode and few people complain, but if "
"passive mode is unsuitable for your application or network setup, call :meth:"
"`set_pasv(0)` on FTP objects to disable passive mode."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:662
msgid ""
"Support for raw socket access has been added to the :mod:`socket` module, "
"contributed by Grant Edwards."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:665
msgid ""
"The :mod:`pstats` module now contains a simple interactive statistics "
"browser for displaying timing profiles for Python programs, invoked when the "
"module is run as a script. Contributed by Eric S. Raymond."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:669
msgid ""
"A new implementation-dependent function, :func:`sys._getframe([depth])`, has "
"been added to return a given frame object from the current call stack. :func:"
"`sys._getframe` returns the frame at the top of the call stack; if the "
"optional integer argument *depth* is supplied, the function returns the "
"frame that is *depth* calls below the top of the stack. For example, ``sys."
"_getframe(1)`` returns the caller's frame object."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:676
msgid ""
"This function is only present in CPython, not in Jython or the .NET "
"implementation. Use it for debugging, and resist the temptation to put it "
"into production code."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:684 ../src/Doc/whatsnew/2.2.rst:1129
#: ../src/Doc/whatsnew/2.3.rst:1960 ../src/Doc/whatsnew/2.7.rst:2353
msgid "Other Changes and Fixes"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:686
msgid ""
"There were relatively few smaller changes made in Python 2.1 due to the "
"shorter release cycle. A search through the CVS change logs turns up 117 "
"patches applied, and 136 bugs fixed; both figures are likely to be "
"underestimates. Some of the more notable changes are:"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:691
msgid ""
"A specialized object allocator is now optionally available, that should be "
"faster than the system :func:`malloc` and have less memory overhead. The "
"allocator uses C's :func:`malloc` function to get large pools of memory, and "
"then fulfills smaller memory requests from these pools. It can be enabled "
"by providing the :option:`--with-pymalloc` option to the :program:"
"`configure` script; see :file:`Objects/obmalloc.c` for the implementation "
"details."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:698
msgid ""
"Authors of C extension modules should test their code with the object "
"allocator enabled, because some incorrect code may break, causing core dumps "
"at runtime. There are a bunch of memory allocation functions in Python's C "
"API that have previously been just aliases for the C library's :func:"
"`malloc` and :func:`free`, meaning that if you accidentally called "
"mismatched functions, the error wouldn't be noticeable. When the object "
"allocator is enabled, these functions aren't aliases of :func:`malloc` and :"
"func:`free` any more, and calling the wrong function to free memory will get "
"you a core dump. For example, if memory was allocated using :func:"
"`PyMem_New`, it has to be freed using :func:`PyMem_Del`, not :func:`free`. "
"A few modules included with Python fell afoul of this and had to be fixed; "
"doubtless there are more third-party modules that will have the same problem."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:711
msgid "The object allocator was contributed by Vladimir Marangozov."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:713
msgid ""
"The speed of line-oriented file I/O has been improved because people often "
"complain about its lack of speed, and because it's often been used as a "
"naïve benchmark. The :meth:`readline` method of file objects has therefore "
"been rewritten to be much faster. The exact amount of the speedup will vary "
"from platform to platform depending on how slow the C library's :func:`getc` "
"was, but is around 66%, and potentially much faster on some particular "
"operating systems. Tim Peters did much of the benchmarking and coding for "
"this change, motivated by a discussion in comp.lang.python."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:722
msgid ""
"A new module and method for file objects was also added, contributed by Jeff "
"Epler. The new method, :meth:`xreadlines`, is similar to the existing :func:"
"`xrange` built-in. :func:`xreadlines` returns an opaque sequence object "
"that only supports being iterated over, reading a line on every iteration "
"but not reading the entire file into memory as the existing :meth:"
"`readlines` method does. You'd use it like this::"
msgstr ""
# 83d76a307b8b41fd8673f3d85dbce5ed
#: ../src/Doc/whatsnew/2.1.rst:733
msgid ""
"For a fuller discussion of the line I/O changes, see the python-dev summary "
"for January 1-15, 2001 at https://www.python.org/dev/summary/2001-01-1/."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:736
msgid ""
"A new method, :meth:`popitem`, was added to dictionaries to enable "
"destructively iterating through the contents of a dictionary; this can be "
"faster for large dictionaries because there's no need to construct a list "
"containing all the keys or values. ``D.popitem()`` removes a random ``(key, "
"value)`` pair from the dictionary ``D`` and returns it as a 2-tuple. This "
"was implemented mostly by Tim Peters and Guido van Rossum, after a "
"suggestion and preliminary patch by Moshe Zadka."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:744
msgid ""
"Modules can now control which names are imported when ``from module import "
"*`` is used, by defining an ``__all__`` attribute containing a list of names "
"that will be imported. One common complaint is that if the module imports "
"other modules such as :mod:`sys` or :mod:`string`, ``from module import *`` "
"will add them to the importing module's namespace. To fix this, simply list "
"the public names in ``__all__``::"
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:754
msgid ""
"A stricter version of this patch was first suggested and implemented by Ben "
"Wolfson, but after some python-dev discussion, a weaker final version was "
"checked in."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:758
msgid ""
"Applying :func:`repr` to strings previously used octal escapes for non-"
"printable characters; for example, a newline was ``'\\012'``. This was a "
"vestigial trace of Python's C ancestry, but today octal is of very little "
"practical use. Ka-Ping Yee suggested using hex escapes instead of octal "
"ones, and using the ``\\n``, ``\\t``, ``\\r`` escapes for the appropriate "
"characters, and implemented this new formatting."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:765
msgid ""
"Syntax errors detected at compile-time can now raise exceptions containing "
"the filename and line number of the error, a pleasant side effect of the "
"compiler reorganization done by Jeremy Hylton."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:769
msgid ""
"C extensions which import other modules have been changed to use :func:"
"`PyImport_ImportModule`, which means that they will use any import hooks "
"that have been installed. This is also encouraged for third-party "
"extensions that need to import some other module from C code."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:774
msgid ""
"The size of the Unicode character database was shrunk by another 340K thanks "
"to Fredrik Lundh."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:777
msgid ""
"Some new ports were contributed: MacOS X (by Steven Majewski), Cygwin (by "
"Jason Tishler); RISCOS (by Dietmar Schwertberger); Unixware 7 (by Billy G. "
"Allie)."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:781
msgid ""
"And there's the usual list of minor bugfixes, minor memory leaks, docstring "
"edits, and other tweaks, too lengthy to be worth itemizing; see the CVS logs "
"for the full details if you want them."
msgstr ""
#: ../src/Doc/whatsnew/2.1.rst:791
msgid ""
"The author would like to thank the following people for offering suggestions "
"on various drafts of this article: Graeme Cross, David Goodger, Jay Graves, "
"Michael Hudson, Marc-André Lemburg, Fredrik Lundh, Neil Schemenauer, Thomas "
"Wouters."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:3
msgid "What's New in Python 2.2"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:15
msgid ""
"This article explains the new features in Python 2.2.2, released on October "
"14, 2002. Python 2.2.2 is a bugfix release of Python 2.2, originally "
"released on December 21, 2001."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:19
msgid ""
"Python 2.2 can be thought of as the \"cleanup release\". There are some "
"features such as generators and iterators that are completely new, but most "
"of the changes, significant and far-reaching though they may be, are aimed "
"at cleaning up irregularities and dark corners of the language design."
msgstr ""
# 1b3eb52a0f6e47c792cc53894116a12e
#: ../src/Doc/whatsnew/2.2.rst:24
msgid ""
"This article doesn't attempt to provide a complete specification of the new "
"features, but instead provides a convenient overview. For full details, you "
"should refer to the documentation for Python 2.2, such as the `Python "
"Library Reference <https://www.python.org/doc/2.2/lib/lib.html>`_ and the "
"`Python Reference Manual <https://www.python.org/doc/2.2/ref/ref.html>`_. "
"If you want to understand the complete implementation and design rationale "
"for a change, refer to the PEP for a particular new feature."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:43
msgid "PEPs 252 and 253: Type and Class Changes"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:45
msgid ""
"The largest and most far-reaching changes in Python 2.2 are to Python's "
"model of objects and classes. The changes should be backward compatible, so "
"it's likely that your code will continue to run unchanged, but the changes "
"provide some amazing new capabilities. Before beginning this, the longest "
"and most complicated section of this article, I'll provide an overview of "
"the changes and offer some comments."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:52
msgid ""
"A long time ago I wrote a Web page listing flaws in Python's design. One of "
"the most significant flaws was that it's impossible to subclass Python types "
"implemented in C. In particular, it's not possible to subclass built-in "
"types, so you can't just subclass, say, lists in order to add a single "
"useful method to them. The :mod:`UserList` module provides a class that "
"supports all of the methods of lists and that can be subclassed further, but "
"there's lots of C code that expects a regular Python list and won't accept "
"a :class:`UserList` instance."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:61
msgid ""
"Python 2.2 fixes this, and in the process adds some exciting new "
"capabilities. A brief summary:"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:64
msgid ""
"You can subclass built-in types such as lists and even integers, and your "
"subclasses should work in every place that requires the original type."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:67
msgid ""
"It's now possible to define static and class methods, in addition to the "
"instance methods available in previous versions of Python."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:70
msgid ""
"It's also possible to automatically call methods on accessing or setting an "
"instance attribute by using a new mechanism called :dfn:`properties`. Many "
"uses of :meth:`__getattr__` can be rewritten to use properties instead, "
"making the resulting code simpler and faster. As a small side benefit, "
"attributes can now have docstrings, too."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:76
msgid ""
"The list of legal attributes for an instance can be limited to a particular "
"set using :dfn:`slots`, making it possible to safeguard against typos and "
"perhaps make more optimizations possible in future versions of Python."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:80
msgid ""
"Some users have voiced concern about all these changes. Sure, they say, the "
"new features are neat and lend themselves to all sorts of tricks that "
"weren't possible in previous versions of Python, but they also make the "
"language more complicated. Some people have said that they've always "
"recommended Python for its simplicity, and feel that its simplicity is being "
"lost."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:86
msgid ""
"Personally, I think there's no need to worry. Many of the new features are "
"quite esoteric, and you can write a lot of Python code without ever needed "
"to be aware of them. Writing a simple class is no more difficult than it "
"ever was, so you don't need to bother learning or teaching them unless "
"they're actually needed. Some very complicated tasks that were previously "
"only possible from C will now be possible in pure Python, and to my mind "
"that's all for the better."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:93
msgid ""
"I'm not going to attempt to cover every single corner case and small change "
"that were required to make the new features work. Instead this section will "
"paint only the broad strokes. See section :ref:`sect-rellinks`, \"Related "
"Links\", for further sources of information about Python 2.2's new object "
"model."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:100
msgid "Old and New Classes"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:102
msgid ""
"First, you should know that Python 2.2 really has two kinds of classes: "
"classic or old-style classes, and new-style classes. The old-style class "
"model is exactly the same as the class model in earlier versions of Python. "
"All the new features described in this section apply only to new-style "
"classes. This divergence isn't intended to last forever; eventually old-"
"style classes will be dropped, possibly in Python 3.0."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:109
msgid ""
"So how do you define a new-style class? You do it by subclassing an "
"existing new-style class. Most of Python's built-in types, such as "
"integers, lists, dictionaries, and even files, are new-style classes now. A "
"new-style class named :class:`object`, the base class for all built-in "
"types, has also been added so if no built-in type is suitable, you can just "
"subclass :class:`object`::"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:121
msgid ""
"This means that :keyword:`class` statements that don't have any base classes "
"are always classic classes in Python 2.2. (Actually you can also change "
"this by setting a module-level variable named :attr:`__metaclass__` --- see :"
"pep:`253` for the details --- but it's easier to just subclass :keyword:"
"`object`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:126
msgid ""
"The type objects for the built-in types are available as built-ins, named "
"using a clever trick. Python has always had built-in functions named :func:"
"`int`, :func:`float`, and :func:`str`. In 2.2, they aren't functions any "
"more, but type objects that behave as factories when called. ::"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:136
msgid ""
"To make the set of types complete, new type objects such as :func:`dict` "
"and :func:`file` have been added. Here's a more interesting example, adding "
"a :meth:`lock` method to file objects::"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:146
msgid ""
"The now-obsolete :mod:`posixfile` module contained a class that emulated all "
"of a file object's methods and also added a :meth:`lock` method, but this "
"class couldn't be passed to internal functions that expected a built-in "
"file, something which is possible with our new :class:`LockableFile`."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:153
msgid "Descriptors"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:155
msgid ""
"In previous versions of Python, there was no consistent way to discover what "
"attributes and methods were supported by an object. There were some informal "
"conventions, such as defining :attr:`__members__` and :attr:`__methods__` "
"attributes that were lists of names, but often the author of an extension "
"type or a class wouldn't bother to define them. You could fall back on "
"inspecting the :attr:`__dict__` of an object, but when class inheritance or "
"an arbitrary :meth:`__getattr__` hook were in use this could still be "
"inaccurate."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:163
msgid ""
"The one big idea underlying the new class model is that an API for "
"describing the attributes of an object using :dfn:`descriptors` has been "
"formalized. Descriptors specify the value of an attribute, stating whether "
"it's a method or a field. With the descriptor API, static methods and class "
"methods become possible, as well as more exotic constructs."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:169
msgid ""
"Attribute descriptors are objects that live inside class objects, and have a "
"few attributes of their own:"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:172
msgid ":attr:`__name__` is the attribute's name."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:174
msgid ":attr:`__doc__` is the attribute's docstring."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:176
msgid ""
":meth:`__get__(object)` is a method that retrieves the attribute value from "
"*object*."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:179
msgid ""
":meth:`__set__(object, value)` sets the attribute on *object* to *value*."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:181
msgid ""
":meth:`__delete__(object, value)` deletes the *value* attribute of *object*."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:183
msgid ""
"For example, when you write ``obj.x``, the steps that Python actually "
"performs are::"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:189
msgid ""
"For methods, :meth:`descriptor.__get__` returns a temporary object that's "
"callable, and wraps up the instance and the method to be called on it. This "
"is also why static methods and class methods are now possible; they have "
"descriptors that wrap up just the method, or the method and the class. As a "
"brief explanation of these new kinds of methods, static methods aren't "
"passed the instance, and therefore resemble regular functions. Class "
"methods are passed the class of the object, but not the object itself. "
"Static and class methods are defined like this::"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:207
msgid ""
"The :func:`staticmethod` function takes the function :func:`f`, and returns "
"it wrapped up in a descriptor so it can be stored in the class object. You "
"might expect there to be special syntax for creating such methods (``def "
"static f``, ``defstatic f()``, or something like that) but no such syntax "
"has been defined yet; that's been left for future versions of Python."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:213
msgid ""
"More new features, such as slots and properties, are also implemented as new "
"kinds of descriptors, and it's not difficult to write a descriptor class "
"that does something novel. For example, it would be possible to write a "
"descriptor class that made it possible to write Eiffel-style preconditions "
"and postconditions for a method. A class that used this feature might be "
"defined like this::"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:235
msgid ""
"Note that a person using the new :func:`eiffelmethod` doesn't have to "
"understand anything about descriptors. This is why I think the new features "
"don't increase the basic complexity of the language. There will be a few "
"wizards who need to know about it in order to write :func:`eiffelmethod` or "
"the ZODB or whatever, but most users will just write code on top of the "
"resulting libraries and ignore the implementation details."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:244
msgid "Multiple Inheritance: The Diamond Rule"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:246
msgid ""
"Multiple inheritance has also been made more useful through changing the "
"rules under which names are resolved. Consider this set of classes (diagram "
"taken from :pep:`253` by Guido van Rossum)::"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:264
msgid ""
"The lookup rule for classic classes is simple but not very smart; the base "
"classes are searched depth-first, going from left to right. A reference to :"
"meth:`D.save` will search the classes :class:`D`, :class:`B`, and then :"
"class:`A`, where :meth:`save` would be found and returned. :meth:`C.save` "
"would never be found at all. This is bad, because if :class:`C`'s :meth:"
"`save` method is saving some internal state specific to :class:`C`, not "
"calling it will result in that state never getting saved."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:272
msgid ""
"New-style classes follow a different algorithm that's a bit more complicated "
"to explain, but does the right thing in this situation. (Note that Python "
"2.3 changes this algorithm to one that produces the same results in most "
"cases, but produces more useful results for really complicated inheritance "
"graphs.)"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:277
msgid ""
"List all the base classes, following the classic lookup rule and include a "
"class multiple times if it's visited repeatedly. In the above example, the "
"list of visited classes is [:class:`D`, :class:`B`, :class:`A`, :class:`C`, :"
"class:`A`]."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:282
msgid ""
"Scan the list for duplicated classes. If any are found, remove all but one "
"occurrence, leaving the *last* one in the list. In the above example, the "
"list becomes [:class:`D`, :class:`B`, :class:`C`, :class:`A`] after dropping "
"duplicates."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:287
msgid ""
"Following this rule, referring to :meth:`D.save` will return :meth:`C.save`, "
"which is the behaviour we're after. This lookup rule is the same as the one "
"followed by Common Lisp. A new built-in function, :func:`super`, provides a "
"way to get at a class's superclasses without having to reimplement Python's "
"algorithm. The most commonly used form will be :func:`super(class, obj)`, "
"which returns a bound superclass object (not the actual class object). "
"This form will be used in methods to call a method in the superclass; for "
"example, :class:`D`'s :meth:`save` method would look like this::"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:303
msgid ""
":func:`super` can also return unbound superclass objects when called as :"
"func:`super(class)` or :func:`super(class1, class2)`, but this probably "
"won't often be useful."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:309
msgid "Attribute Access"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:311
msgid ""
"A fair number of sophisticated Python classes define hooks for attribute "
"access using :meth:`__getattr__`; most commonly this is done for "
"convenience, to make code more readable by automatically mapping an "
"attribute access such as ``obj.parent`` into a method call such as ``obj."
"get_parent``. Python 2.2 adds some new ways of controlling attribute access."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:317
msgid ""
"First, :meth:`__getattr__(attr_name)` is still supported by new-style "
"classes, and nothing about it has changed. As before, it will be called "
"when an attempt is made to access ``obj.foo`` and no attribute named ``foo`` "
"is found in the instance's dictionary."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:322
msgid ""
"New-style classes also support a new method, :meth:"
"`__getattribute__(attr_name)`. The difference between the two methods is "
"that :meth:`__getattribute__` is *always* called whenever any attribute is "
"accessed, while the old :meth:`__getattr__` is only called if ``foo`` isn't "
"found in the instance's dictionary."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:328
msgid ""
"However, Python 2.2's support for :dfn:`properties` will often be a simpler "
"way to trap attribute references. Writing a :meth:`__getattr__` method is "
"complicated because to avoid recursion you can't use regular attribute "
"accesses inside them, and instead have to mess around with the contents of :"
"attr:`__dict__`. :meth:`__getattr__` methods also end up being called by "
"Python when it checks for other methods such as :meth:`__repr__` or :meth:"
"`__coerce__`, and so have to be written with this in mind. Finally, calling "
"a function on every attribute access results in a sizable performance loss."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:337
msgid ""
":class:`property` is a new built-in type that packages up three functions "
"that get, set, or delete an attribute, and a docstring. For example, if you "
"want to define a :attr:`size` attribute that's computed, but also settable, "
"you could write::"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:357
msgid ""
"That is certainly clearer and easier to write than a pair of :meth:"
"`__getattr__`/:meth:`__setattr__` methods that check for the :attr:`size` "
"attribute and handle it specially while retrieving all other attributes from "
"the instance's :attr:`__dict__`. Accesses to :attr:`size` are also the only "
"ones which have to perform the work of calling a function, so references to "
"other attributes run at their usual speed."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:364
msgid ""
"Finally, it's possible to constrain the list of attributes that can be "
"referenced on an object using the new :attr:`__slots__` class attribute. "
"Python objects are usually very dynamic; at any time it's possible to define "
"a new attribute on an instance by just doing ``obj.new_attr=1``. A new-"
"style class can define a class attribute named :attr:`__slots__` to limit "
"the legal attributes to a particular set of names. An example will make "
"this clear::"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:385
msgid ""
"Note how you get an :exc:`AttributeError` on the attempt to assign to an "
"attribute not listed in :attr:`__slots__`."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:392
msgid "Related Links"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:394
msgid ""
"This section has just been a quick overview of the new features, giving "
"enough of an explanation to start you programming, but many details have "
"been simplified or ignored. Where should you go to get a more complete "
"picture?"
msgstr ""
# a6511ea8abed4ddbbda273708c468661
#: ../src/Doc/whatsnew/2.2.rst:398
msgid ""
"https://www.python.org/2.2/descrintro.html is a lengthy tutorial "
"introduction to the descriptor features, written by Guido van Rossum. If my "
"description has whetted your appetite, go read this tutorial next, because "
"it goes into much more detail about the new features while still remaining "
"quite easy to read."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:403
msgid ""
"Next, there are two relevant PEPs, :pep:`252` and :pep:`253`. :pep:`252` is "
"titled \"Making Types Look More Like Classes\", and covers the descriptor "
"API. :pep:`253` is titled \"Subtyping Built-in Types\", and describes the "
"changes to type objects that make it possible to subtype built-in objects. :"
"pep:`253` is the more complicated PEP of the two, and at a few points the "
"necessary explanations of types and meta-types may cause your head to "
"explode. Both PEPs were written and implemented by Guido van Rossum, with "
"substantial assistance from the rest of the Zope Corp. team."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:412
msgid ""
"Finally, there's the ultimate authority: the source code. Most of the "
"machinery for the type handling is in :file:`Objects/typeobject.c`, but you "
"should only resort to it after all other avenues have been exhausted, "
"including posting a question to python-list or python-dev."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:421
msgid "PEP 234: Iterators"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:423
msgid ""
"Another significant addition to 2.2 is an iteration interface at both the C "
"and Python levels. Objects can define how they can be looped over by "
"callers."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:426
msgid ""
"In Python versions up to 2.1, the usual way to make ``for item in obj`` work "
"is to define a :meth:`__getitem__` method that looks something like this::"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:432
msgid ""
":meth:`__getitem__` is more properly used to define an indexing operation on "
"an object so that you can write ``obj[5]`` to retrieve the sixth element. "
"It's a bit misleading when you're using this only to support :keyword:`for` "
"loops. Consider some file-like object that wants to be looped over; the "
"*index* parameter is essentially meaningless, as the class probably assumes "
"that a series of :meth:`__getitem__` calls will be made with *index* "
"incrementing by one each time. In other words, the presence of the :meth:"
"`__getitem__` method doesn't mean that using ``file[5]`` to randomly access "
"the sixth element will work, though it really should."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:442
msgid ""
"In Python 2.2, iteration can be implemented separately, and :meth:"
"`__getitem__` methods can be limited to classes that really do support "
"random access. The basic idea of iterators is simple. A new built-in "
"function, :func:`iter(obj)` or ``iter(C, sentinel)``, is used to get an "
"iterator. :func:`iter(obj)` returns an iterator for the object *obj*, while "
"``iter(C, sentinel)`` returns an iterator that will invoke the callable "
"object *C* until it returns *sentinel* to signal that the iterator is done."
msgstr ""
# 7b7989094d354beeab0ba4a3515646f3
#: ../src/Doc/whatsnew/2.2.rst:450
msgid ""
"Python classes can define an :meth:`__iter__` method, which should create "
"and return a new iterator for the object; if the object is its own iterator, "
"this method can just return ``self``. In particular, iterators will usually "
"be their own iterators. Extension types implemented in C can implement a :c:"
"member:`~PyTypeObject.tp_iter` function in order to return an iterator, and "
"extension types that want to behave as iterators can define a :c:member:"
"`~PyTypeObject.tp_iternext` function."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:457
msgid ""
"So, after all this, what do iterators actually do? They have one required "
"method, :meth:`next`, which takes no arguments and returns the next value. "
"When there are no more values to be returned, calling :meth:`next` should "
"raise the :exc:`StopIteration` exception. ::"
msgstr ""
# 04854cb943c9489e981393c6c0503d83
#: ../src/Doc/whatsnew/2.2.rst:478
msgid ""
"In 2.2, Python's :keyword:`for` statement no longer expects a sequence; it "
"expects something for which :func:`iter` will return an iterator. For "
"backward compatibility and convenience, an iterator is automatically "
"constructed for sequences that don't implement :meth:`__iter__` or a :c:"
"member:`~PyTypeObject.tp_iter` slot, so ``for i in [1,2,3]`` will still "
"work. Wherever the Python interpreter loops over a sequence, it's been "
"changed to use the iterator protocol. This means you can do things like "
"this::"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:492
msgid ""
"Iterator support has been added to some of Python's basic types. Calling :"
"func:`iter` on a dictionary will return an iterator which loops over its "
"keys::"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:512
msgid ""
"That's just the default behaviour. If you want to iterate over keys, "
"values, or key/value pairs, you can explicitly call the :meth:`iterkeys`, :"
"meth:`itervalues`, or :meth:`iteritems` methods to get an appropriate "
"iterator. In a minor related change, the :keyword:`in` operator now works on "
"dictionaries, so ``key in dict`` is now equivalent to ``dict.has_key(key)``."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:518
msgid ""
"Files also provide an iterator, which calls the :meth:`readline` method "
"until there are no more lines in the file. This means you can now read each "
"line of a file using code like this::"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:526
msgid ""
"Note that you can only go forward in an iterator; there's no way to get the "
"previous element, reset the iterator, or make a copy of it. An iterator "
"object could provide such additional capabilities, but the iterator protocol "
"only requires a :meth:`next` method."
msgstr ""
# da4826c3821d4840b3e7f12907ef3f2f
#: ../src/Doc/whatsnew/2.2.rst:534
msgid ":pep:`234` - Iterators"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:535
msgid ""
"Written by Ka-Ping Yee and GvR; implemented by the Python Labs crew, mostly "
"by GvR and Tim Peters."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:542 ../src/Doc/whatsnew/2.3.rst:126
msgid "PEP 255: Simple Generators"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:544
msgid ""
"Generators are another new feature, one that interacts with the introduction "
"of iterators."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:547
msgid ""
"You're doubtless familiar with how function calls work in Python or C. When "
"you call a function, it gets a private namespace where its local variables "
"are created. When the function reaches a :keyword:`return` statement, the "
"local variables are destroyed and the resulting value is returned to the "
"caller. A later call to the same function will get a fresh new set of local "
"variables. But, what if the local variables weren't thrown away on exiting a "
"function? What if you could later resume the function where it left off? "
"This is what generators provide; they can be thought of as resumable "
"functions."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:556 ../src/Doc/whatsnew/2.3.rst:145
msgid "Here's the simplest example of a generator function::"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:562
msgid ""
"A new keyword, :keyword:`yield`, was introduced for generators. Any "
"function containing a :keyword:`yield` statement is a generator function; "
"this is detected by Python's bytecode compiler which compiles the function "
"specially as a result. Because a new keyword was introduced, generators "
"must be explicitly enabled in a module by including a ``from __future__ "
"import generators`` statement near the top of the module's source code. In "
"Python 2.3 this statement will become unnecessary."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:570
msgid ""
"When you call a generator function, it doesn't return a single value; "
"instead it returns a generator object that supports the iterator protocol. "
"On executing the :keyword:`yield` statement, the generator outputs the value "
"of ``i``, similar to a :keyword:`return` statement. The big difference "
"between :keyword:`yield` and a :keyword:`return` statement is that on "
"reaching a :keyword:`yield` the generator's state of execution is suspended "
"and local variables are preserved. On the next call to the generator's "
"``next()`` method, the function will resume executing immediately after the :"
"keyword:`yield` statement. (For complicated reasons, the :keyword:`yield` "
"statement isn't allowed inside the :keyword:`try` block of a :keyword:"
"`try`...\\ :keyword:`finally` statement; read :pep:`255` for a full "
"explanation of the interaction between :keyword:`yield` and exceptions.)"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:583 ../src/Doc/whatsnew/2.3.rst:169
msgid "Here's a sample usage of the :func:`generate_ints` generator::"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:600 ../src/Doc/whatsnew/2.3.rst:186
msgid ""
"You could equally write ``for i in generate_ints(5)``, or ``a,b,c = "
"generate_ints(3)``."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:603 ../src/Doc/whatsnew/2.3.rst:189
msgid ""
"Inside a generator function, the :keyword:`return` statement can only be "
"used without a value, and signals the end of the procession of values; "
"afterwards the generator cannot return any further values. :keyword:`return` "
"with a value, such as ``return 5``, is a syntax error inside a generator "
"function. The end of the generator's results can also be indicated by "
"raising :exc:`StopIteration` manually, or by just letting the flow of "
"execution fall off the bottom of the function."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:611 ../src/Doc/whatsnew/2.3.rst:197
msgid ""
"You could achieve the effect of generators manually by writing your own "
"class and storing all the local variables of the generator as instance "
"variables. For example, returning a list of integers could be done by "
"setting ``self.count`` to 0, and having the :meth:`next` method increment "
"``self.count`` and return it. However, for a moderately complicated "
"generator, writing a corresponding class would be much messier. :file:`Lib/"
"test/test_generators.py` contains a number of more interesting examples. "
"The simplest one implements an in-order traversal of a tree using generators "
"recursively. ::"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:629 ../src/Doc/whatsnew/2.3.rst:215
msgid ""
"Two other examples in :file:`Lib/test/test_generators.py` produce solutions "
"for the N-Queens problem (placing $N$ queens on an $NxN$ chess board so that "
"no queen threatens another) and the Knight's Tour (a route that takes a "
"knight to every square of an $NxN$ chessboard without visiting any square "
"twice)."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:634 ../src/Doc/whatsnew/2.3.rst:220
msgid ""
"The idea of generators comes from other programming languages, especially "
"Icon (http://www.cs.arizona.edu/icon/), where the idea of generators is "
"central. In Icon, every expression and function call behaves like a "
"generator. One example from \"An Overview of the Icon Programming Language"
"\" at http://www.cs.arizona.edu/icon/docs/ipd266.htm gives an idea of what "
"this looks like::"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:644 ../src/Doc/whatsnew/2.3.rst:230
msgid ""
"In Icon the :func:`find` function returns the indexes at which the substring "
"\"or\" is found: 3, 23, 33. In the :keyword:`if` statement, ``i`` is first "
"assigned a value of 3, but 3 is less than 5, so the comparison fails, and "
"Icon retries it with the second value of 23. 23 is greater than 5, so the "
"comparison now succeeds, and the code prints the value 23 to the screen."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:650
msgid ""
"Python doesn't go nearly as far as Icon in adopting generators as a central "
"concept. Generators are considered a new part of the core Python language, "
"but learning or using them isn't compulsory; if they don't solve any "
"problems that you have, feel free to ignore them. One novel feature of "
"Python's interface as compared to Icon's is that a generator's state is "
"represented as a concrete object (the iterator) that can be passed around to "
"other functions or stored in a data structure."
msgstr ""
# e9b970fdade04e638b157566891868b0
# 23a1158da5ab4a319487ff725279a8b0
#: ../src/Doc/whatsnew/2.2.rst:661 ../src/Doc/whatsnew/2.3.rst:247
msgid ":pep:`255` - Simple Generators"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:662 ../src/Doc/whatsnew/2.3.rst:248
msgid ""
"Written by Neil Schemenauer, Tim Peters, Magnus Lie Hetland. Implemented "
"mostly by Neil Schemenauer and Tim Peters, with other fixes from the Python "
"Labs crew."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:669 ../src/Doc/whatsnew/2.4.rst:90
msgid "PEP 237: Unifying Long Integers and Integers"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:671
msgid ""
"In recent versions, the distinction between regular integers, which are 32-"
"bit values on most machines, and long integers, which can be of arbitrary "
"size, was becoming an annoyance. For example, on platforms that support "
"files larger than ``2**32`` bytes, the :meth:`tell` method of file objects "
"has to return a long integer. However, there were various bits of Python "
"that expected plain integers and would raise an error if a long integer was "
"provided instead. For example, in Python 1.5, only regular integers could "
"be used as a slice index, and ``'abc'[1L:]`` would raise a :exc:`TypeError` "
"exception with the message 'slice index must be int'."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:681
msgid ""
"Python 2.2 will shift values from short to long integers as required. The "
"'L' suffix is no longer needed to indicate a long integer literal, as now "
"the compiler will choose the appropriate type. (Using the 'L' suffix will "
"be discouraged in future 2.x versions of Python, triggering a warning in "
"Python 2.4, and probably dropped in Python 3.0.) Many operations that used "
"to raise an :exc:`OverflowError` will now return a long integer as their "
"result. For example::"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:694
msgid ""
"In most cases, integers and long integers will now be treated identically. "
"You can still distinguish them with the :func:`type` built-in function, but "
"that's rarely needed."
msgstr ""
# 50e4d1629ec14573b38c7c856e43b67e
# 3f5bf40c9f7346cdb97ff85a78f1fc99
#: ../src/Doc/whatsnew/2.2.rst:701 ../src/Doc/whatsnew/2.4.rst:107
msgid ":pep:`237` - Unifying Long Integers and Integers"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:702
msgid ""
"Written by Moshe Zadka and Guido van Rossum. Implemented mostly by Guido "
"van Rossum."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:709
msgid "PEP 238: Changing the Division Operator"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:711
msgid ""
"The most controversial change in Python 2.2 heralds the start of an effort "
"to fix an old design flaw that's been in Python from the beginning. "
"Currently Python's division operator, ``/``, behaves like C's division "
"operator when presented with two integer arguments: it returns an integer "
"result that's truncated down when there would be a fractional part. For "
"example, ``3/2`` is 1, not 1.5, and ``(-1)/2`` is -1, not -0.5. This means "
"that the results of division can vary unexpectedly depending on the type of "
"the two operands and because Python is dynamically typed, it can be "
"difficult to determine the possible types of the operands."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:721
msgid ""
"(The controversy is over whether this is *really* a design flaw, and whether "
"it's worth breaking existing code to fix this. It's caused endless "
"discussions on python-dev, and in July 2001 erupted into an storm of acidly "
"sarcastic postings on :newsgroup:`comp.lang.python`. I won't argue for "
"either side here and will stick to describing what's implemented in 2.2. "
"Read :pep:`238` for a summary of arguments and counter-arguments.)"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:728
msgid ""
"Because this change might break code, it's being introduced very gradually. "
"Python 2.2 begins the transition, but the switch won't be complete until "
"Python 3.0."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:732
msgid ""
"First, I'll borrow some terminology from :pep:`238`. \"True division\" is "
"the division that most non-programmers are familiar with: 3/2 is 1.5, 1/4 is "
"0.25, and so forth. \"Floor division\" is what Python's ``/`` operator "
"currently does when given integer operands; the result is the floor of the "
"value returned by true division. \"Classic division\" is the current mixed "
"behaviour of ``/``; it returns the result of floor division when the "
"operands are integers, and returns the result of true division when one of "
"the operands is a floating-point number."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:740
msgid "Here are the changes 2.2 introduces:"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:742
msgid ""
"A new operator, ``//``, is the floor division operator. (Yes, we know it "
"looks like C++'s comment symbol.) ``//`` *always* performs floor division "
"no matter what the types of its operands are, so ``1 // 2`` is 0 and "
"``1.0 // 2.0`` is also 0.0."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:747
msgid ""
"``//`` is always available in Python 2.2; you don't need to enable it using "
"a ``__future__`` statement."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:750
msgid ""
"By including a ``from __future__ import division`` in a module, the ``/`` "
"operator will be changed to return the result of true division, so ``1/2`` "
"is 0.5. Without the ``__future__`` statement, ``/`` still means classic "
"division. The default meaning of ``/`` will not change until Python 3.0."
msgstr ""
# 542987ce4aec475ca712794d1bb781a1
#: ../src/Doc/whatsnew/2.2.rst:755
msgid ""
"Classes can define methods called :meth:`__truediv__` and :meth:"
"`__floordiv__` to overload the two division operators. At the C level, "
"there are also slots in the :c:type:`PyNumberMethods` structure so extension "
"types can define the two operators."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:760
msgid ""
"Python 2.2 supports some command-line arguments for testing whether code "
"will works with the changed division semantics. Running python with :option:"
"`-Q warn` will cause a warning to be issued whenever division is applied to "
"two integers. You can use this to find code that's affected by the change "
"and fix it. By default, Python 2.2 will simply perform classic division "
"without a warning; the warning will be turned on by default in Python 2.3."
msgstr ""
# f396a8db59c04d5f800eb7f053ca198d
#: ../src/Doc/whatsnew/2.2.rst:769
msgid ":pep:`238` - Changing the Division Operator"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:771
msgid ""
"Written by Moshe Zadka and Guido van Rossum. Implemented by Guido van "
"Rossum.."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:777
msgid "Unicode Changes"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:779
msgid ""
"Python's Unicode support has been enhanced a bit in 2.2. Unicode strings "
"are usually stored as UCS-2, as 16-bit unsigned integers. Python 2.2 can "
"also be compiled to use UCS-4, 32-bit unsigned integers, as its internal "
"encoding by supplying :option:`--enable-unicode=ucs4` to the configure "
"script. (It's also possible to specify :option:`--disable-unicode` to "
"completely disable Unicode support.)"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:786
msgid ""
"When built to use UCS-4 (a \"wide Python\"), the interpreter can natively "
"handle Unicode characters from U+000000 to U+110000, so the range of legal "
"values for the :func:`unichr` function is expanded accordingly. Using an "
"interpreter compiled to use UCS-2 (a \"narrow Python\"), values greater than "
"65535 will still cause :func:`unichr` to raise a :exc:`ValueError` "
"exception. This is all described in :pep:`261`, \"Support for 'wide' Unicode "
"characters\"; consult it for further details."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:794
msgid ""
"Another change is simpler to explain. Since their introduction, Unicode "
"strings have supported an :meth:`encode` method to convert the string to a "
"selected encoding such as UTF-8 or Latin-1. A symmetric :meth:"
"`decode([*encoding*])` method has been added to 8-bit strings (though not to "
"Unicode strings) in 2.2. :meth:`decode` assumes that the string is in the "
"specified encoding and decodes it, returning whatever is returned by the "
"codec."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:801
msgid ""
"Using this new feature, codecs have been added for tasks not directly "
"related to Unicode. For example, codecs have been added for uu-encoding, "
"MIME's base64 encoding, and compression with the :mod:`zlib` module::"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:822
msgid ""
"To convert a class instance to Unicode, a :meth:`__unicode__` method can be "
"defined by a class, analogous to :meth:`__str__`."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:825
msgid ""
":meth:`encode`, :meth:`decode`, and :meth:`__unicode__` were implemented by "
"Marc-André Lemburg. The changes to support using UCS-4 internally were "
"implemented by Fredrik Lundh and Martin von Löwis."
msgstr ""
# 2e0d71902bc7484a949a945a54fa541e
#: ../src/Doc/whatsnew/2.2.rst:831
msgid ":pep:`261` - Support for 'wide' Unicode characters"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:833
msgid "Written by Paul Prescod."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:841
msgid ""
"In Python 2.1, statically nested scopes were added as an optional feature, "
"to be enabled by a ``from __future__ import nested_scopes`` directive. In "
"2.2 nested scopes no longer need to be specially enabled, and are now always "
"present. The rest of this section is a copy of the description of nested "
"scopes from my \"What's New in Python 2.1\" document; if you read it when "
"2.1 came out, you can skip the rest of this section."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:848
msgid ""
"The largest change introduced in Python 2.1, and made complete in 2.2, is to "
"Python's scoping rules. In Python 2.0, at any given time there are at most "
"three namespaces used to look up variable names: local, module-level, and "
"the built-in namespace. This often surprised people because it didn't match "
"their intuitive expectations. For example, a nested recursive function "
"definition doesn't work::"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:879
msgid ""
"The most significant change to Python 2.2 is that static scoping has been "
"added to the language to fix this problem. As a first effect, the "
"``name=name`` default argument is now unnecessary in the above example. Put "
"simply, when a given variable name is not assigned a value within a function "
"(by an assignment, or the :keyword:`def`, :keyword:`class`, or :keyword:"
"`import` statements), references to the variable will be looked up in the "
"local namespace of the enclosing scope. A more detailed explanation of the "
"rules, and a dissection of the implementation, can be found in the PEP."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:936
msgid ""
"The :mod:`xmlrpclib` module was contributed to the standard library by "
"Fredrik Lundh, providing support for writing XML-RPC clients. XML-RPC is a "
"simple remote procedure call protocol built on top of HTTP and XML. For "
"example, the following snippet retrieves a list of RSS channels from the "
"O'Reilly Network, and then lists the recent headlines for one channel::"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:959
msgid ""
"The :mod:`SimpleXMLRPCServer` module makes it easy to create straightforward "
"XML-RPC servers. See http://www.xmlrpc.com/ for more information about XML-"
"RPC."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:962
msgid ""
"The new :mod:`hmac` module implements the HMAC algorithm described by :rfc:"
"`2104`. (Contributed by Gerhard Häring.)"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:965
msgid ""
"Several functions that originally returned lengthy tuples now return pseudo- "
"sequences that still behave like tuples but also have mnemonic attributes "
"such as memberst_mtime or :attr:`tm_year`. The enhanced functions include :"
"func:`stat`, :func:`fstat`, :func:`statvfs`, and :func:`fstatvfs` in the :"
"mod:`os` module, and :func:`localtime`, :func:`gmtime`, and :func:`strptime` "
"in the :mod:`time` module."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:972
msgid ""
"For example, to obtain a file's size using the old tuples, you'd end up "
"writing something like ``file_size = os.stat(filename)[stat.ST_SIZE]``, but "
"now this can be written more clearly as ``file_size = os.stat(filename)."
"st_size``."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:976
msgid "The original patch for this feature was contributed by Nick Mathewson."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:978
msgid ""
"The Python profiler has been extensively reworked and various errors in its "
"output have been corrected. (Contributed by Fred L. Drake, Jr. and Tim "
"Peters.)"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:981
msgid ""
"The :mod:`socket` module can be compiled to support IPv6; specify the :"
"option:`--enable-ipv6` option to Python's configure script. (Contributed by "
"Jun-ichiro \"itojun\" Hagino.)"
msgstr ""
# ca2b8899363b4c50ad112c550014c025
#: ../src/Doc/whatsnew/2.2.rst:985
msgid ""
"Two new format characters were added to the :mod:`struct` module for 64-bit "
"integers on platforms that support the C :c:type:`long long` type. ``q`` is "
"for a signed 64-bit integer, and ``Q`` is for an unsigned one. The value is "
"returned in Python's long integer type. (Contributed by Tim Peters.)"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:990
msgid ""
"In the interpreter's interactive mode, there's a new built-in function :func:"
"`help` that uses the :mod:`pydoc` module introduced in Python 2.1 to provide "
"interactive help. ``help(object)`` displays any available help text about "
"*object*. :func:`help` with no argument puts you in an online help utility, "
"where you can enter the names of functions, classes, or modules to read "
"their help text. (Contributed by Guido van Rossum, using Ka-Ping Yee's :mod:"
"`pydoc` module.)"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:998
msgid ""
"Various bugfixes and performance improvements have been made to the SRE "
"engine underlying the :mod:`re` module. For example, the :func:`re.sub` "
"and :func:`re.split` functions have been rewritten in C. Another "
"contributed patch speeds up certain Unicode character ranges by a factor of "
"two, and a new :meth:`finditer` method that returns an iterator over all "
"the non-overlapping matches in a given string. (SRE is maintained by "
"Fredrik Lundh. The BIGCHARSET patch was contributed by Martin von Löwis.)"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:1006
msgid ""
"The :mod:`smtplib` module now supports :rfc:`2487`, \"Secure SMTP over TLS"
"\", so it's now possible to encrypt the SMTP traffic between a Python "
"program and the mail transport agent being handed a message. :mod:`smtplib` "
"also supports SMTP authentication. (Contributed by Gerhard Häring.)"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:1011
msgid ""
"The :mod:`imaplib` module, maintained by Piers Lauder, has support for "
"several new extensions: the NAMESPACE extension defined in :rfc:`2342`, "
"SORT, GETACL and SETACL. (Contributed by Anthony Baxter and Michel "
"Pelletier.)"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:1015
msgid ""
"The :mod:`rfc822` module's parsing of email addresses is now compliant with :"
"rfc:`2822`, an update to :rfc:`822`. (The module's name is *not* going to "
"be changed to ``rfc2822``.) A new package, :mod:`email`, has also been "
"added for parsing and generating e-mail messages. (Contributed by Barry "
"Warsaw, and arising out of his work on Mailman.)"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:1021
msgid ""
"The :mod:`difflib` module now contains a new :class:`Differ` class for "
"producing human-readable lists of changes (a \"delta\") between two "
"sequences of lines of text. There are also two generator functions, :func:"
"`ndiff` and :func:`restore`, which respectively return a delta from two "
"sequences, or one of the original sequences from a delta. (Grunt work "
"contributed by David Goodger, from ndiff.py code by Tim Peters who then did "
"the generatorization.)"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:1028
msgid ""
"New constants :const:`ascii_letters`, :const:`ascii_lowercase`, and :const:"
"`ascii_uppercase` were added to the :mod:`string` module. There were "
"several modules in the standard library that used :const:`string.letters` to "
"mean the ranges A-Za-z, but that assumption is incorrect when locales are in "
"use, because :const:`string.letters` varies depending on the set of legal "
"characters defined by the current locale. The buggy modules have all been "
"fixed to use :const:`ascii_letters` instead. (Reported by an unknown person; "
"fixed by Fred L. Drake, Jr.)"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:1037
msgid ""
"The :mod:`mimetypes` module now makes it easier to use alternative MIME-type "
"databases by the addition of a :class:`MimeTypes` class, which takes a list "
"of filenames to be parsed. (Contributed by Fred L. Drake, Jr.)"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:1041
msgid ""
"A :class:`Timer` class was added to the :mod:`threading` module that allows "
"scheduling an activity to happen at some future time. (Contributed by "
"Itamar Shtull-Trauring.)"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:1049
msgid "Interpreter Changes and Fixes"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:1051
msgid ""
"Some of the changes only affect people who deal with the Python interpreter "
"at the C level because they're writing Python extension modules, embedding "
"the interpreter, or just hacking on the interpreter itself. If you only "
"write Python code, none of the changes described here will affect you very "
"much."
msgstr ""
# 662ef75078da45af982a76152dd878bd
#: ../src/Doc/whatsnew/2.2.rst:1056
msgid ""
"Profiling and tracing functions can now be implemented in C, which can "
"operate at much higher speeds than Python-based functions and should reduce "
"the overhead of profiling and tracing. This will be of interest to authors "
"of development environments for Python. Two new C functions were added to "
"Python's API, :c:func:`PyEval_SetProfile` and :c:func:`PyEval_SetTrace`. The "
"existing :func:`sys.setprofile` and :func:`sys.settrace` functions still "
"exist, and have simply been changed to use the new C-level interface. "
"(Contributed by Fred L. Drake, Jr.)"
msgstr ""
# 610d706f74894d73ab10cd5f280695b1
#: ../src/Doc/whatsnew/2.2.rst:1065
msgid ""
"Another low-level API, primarily of interest to implementors of Python "
"debuggers and development tools, was added. :c:func:"
"`PyInterpreterState_Head` and :c:func:`PyInterpreterState_Next` let a caller "
"walk through all the existing interpreter objects; :c:func:"
"`PyInterpreterState_ThreadHead` and :c:func:`PyThreadState_Next` allow "
"looping over all the thread states for a given interpreter. (Contributed by "
"David Beazley.)"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:1072
msgid ""
"The C-level interface to the garbage collector has been changed to make it "
"easier to write extension types that support garbage collection and to debug "
"misuses of the functions. Various functions have slightly different "
"semantics, so a bunch of functions had to be renamed. Extensions that use "
"the old API will still compile but will *not* participate in garbage "
"collection, so updating them for 2.2 should be considered fairly high "
"priority."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:1079
msgid ""
"To upgrade an extension module to the new API, perform the following steps:"
msgstr ""
# 76d2e3f9fef44a27815199143ed81800
#: ../src/Doc/whatsnew/2.2.rst:1081
msgid "Rename :c:func:`Py_TPFLAGS_GC` to :c:func:`PyTPFLAGS_HAVE_GC`."
msgstr ""
# e37a0b9fd11f4544853a1d1e1e6ed199
#: ../src/Doc/whatsnew/2.2.rst:1083
msgid ""
"Use :c:func:`PyObject_GC_New` or :c:func:`PyObject_GC_NewVar` to allocate"
msgstr ""
# 47a7e05176ea4aa991508d7edc335eb5
#: ../src/Doc/whatsnew/2.2.rst:1084
msgid "objects, and :c:func:`PyObject_GC_Del` to deallocate them."
msgstr ""
# 4a9c585bea85475394ce3813e74a1360
#: ../src/Doc/whatsnew/2.2.rst:1086
msgid "Rename :c:func:`PyObject_GC_Init` to :c:func:`PyObject_GC_Track` and"
msgstr ""
# 802f896513a94c1b82f983f4d68dba44
#: ../src/Doc/whatsnew/2.2.rst:1087
msgid ":c:func:`PyObject_GC_Fini` to :c:func:`PyObject_GC_UnTrack`."
msgstr ""
# 65db9ed80927491aa00b12fba60c46f1
#: ../src/Doc/whatsnew/2.2.rst:1089
msgid "Remove :c:func:`PyGC_HEAD_SIZE` from object size calculations."
msgstr ""
# 101f369b5d994e36adc0efb37c120957
#: ../src/Doc/whatsnew/2.2.rst:1091
msgid ""
"Remove calls to :c:func:`PyObject_AS_GC` and :c:func:`PyObject_FROM_GC`."
msgstr ""
# 329a53540ac948f18ae6cfbeeeb03df6
#: ../src/Doc/whatsnew/2.2.rst:1093
msgid ""
"A new ``et`` format sequence was added to :c:func:`PyArg_ParseTuple`; ``et`` "
"takes both a parameter and an encoding name, and converts the parameter to "
"the given encoding if the parameter turns out to be a Unicode string, or "
"leaves it alone if it's an 8-bit string, assuming it to already be in the "
"desired encoding. This differs from the ``es`` format character, which "
"assumes that 8-bit strings are in Python's default ASCII encoding and "
"converts them to the specified new encoding. (Contributed by M.-A. Lemburg, "
"and used for the MBCS support on Windows described in the following section.)"
msgstr ""
# 0e4b7c2bc4b24fdcbcbeee0c64e039d5
#: ../src/Doc/whatsnew/2.2.rst:1102
msgid ""
"A different argument parsing function, :c:func:`PyArg_UnpackTuple`, has been "
"added that's simpler and presumably faster. Instead of specifying a format "
"string, the caller simply gives the minimum and maximum number of arguments "
"expected, and a set of pointers to :c:type:`PyObject\\*` variables that will "
"be filled in with argument values."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:1108
msgid ""
"Two new flags :const:`METH_NOARGS` and :const:`METH_O` are available in "
"method definition tables to simplify implementation of methods with no "
"arguments or a single untyped argument. Calling such methods is more "
"efficient than calling a corresponding method that uses :const:"
"`METH_VARARGS`. Also, the old :const:`METH_OLDARGS` style of writing C "
"methods is now officially deprecated."
msgstr ""
# 2e32c7b2c1be40d985807373d1042cca
#: ../src/Doc/whatsnew/2.2.rst:1114
msgid ""
"Two new wrapper functions, :c:func:`PyOS_snprintf` and :c:func:"
"`PyOS_vsnprintf` were added to provide cross-platform implementations for "
"the relatively new :c:func:`snprintf` and :c:func:`vsnprintf` C lib APIs. In "
"contrast to the standard :c:func:`sprintf` and :c:func:`vsprintf` functions, "
"the Python versions check the bounds of the buffer used to protect against "
"buffer overruns. (Contributed by M.-A. Lemburg.)"
msgstr ""
# d59cee52825f44949effe9ac39089ff4
#: ../src/Doc/whatsnew/2.2.rst:1121
msgid ""
"The :c:func:`_PyTuple_Resize` function has lost an unused parameter, so now "
"it takes 2 parameters instead of 3. The third argument was never used, and "
"can simply be discarded when porting code from earlier versions to Python "
"2.2."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:1131
msgid ""
"As usual there were a bunch of other improvements and bugfixes scattered "
"throughout the source tree. A search through the CVS change logs finds "
"there were 527 patches applied and 683 bugs fixed between Python 2.1 and "
"2.2; 2.2.1 applied 139 patches and fixed 143 bugs; 2.2.2 applied 106 patches "
"and fixed 82 bugs. These figures are likely to be underestimates."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:1137 ../src/Doc/whatsnew/2.3.rst:1967
msgid "Some of the more notable changes are:"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:1139
msgid ""
"The code for the MacOS port for Python, maintained by Jack Jansen, is now "
"kept in the main Python CVS tree, and many changes have been made to support "
"MacOS X."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:1142
msgid ""
"The most significant change is the ability to build Python as a framework, "
"enabled by supplying the :option:`--enable-framework` option to the "
"configure script when compiling Python. According to Jack Jansen, \"This "
"installs a self- contained Python installation plus the OS X framework \"glue"
"\" into :file:`/Library/Frameworks/Python.framework` (or another location of "
"choice). For now there is little immediate added benefit to this (actually, "
"there is the disadvantage that you have to change your PATH to be able to "
"find Python), but it is the basis for creating a full-blown Python "
"application, porting the MacPython IDE, possibly using Python as a standard "
"OSA scripting language and much more.\""
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:1153
msgid ""
"Most of the MacPython toolbox modules, which interface to MacOS APIs such as "
"windowing, QuickTime, scripting, etc. have been ported to OS X, but they've "
"been left commented out in :file:`setup.py`. People who want to experiment "
"with these modules can uncomment them manually."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:1176
msgid ""
"Keyword arguments passed to built-in functions that don't take them now "
"cause a :exc:`TypeError` exception to be raised, with the message "
"\"*function* takes no keyword arguments\"."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:1180
msgid ""
"Weak references, added in Python 2.1 as an extension module, are now part of "
"the core because they're used in the implementation of new-style classes. "
"The :exc:`ReferenceError` exception has therefore moved from the :mod:"
"`weakref` module to become a built-in exception."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:1185
msgid ""
"A new script, :file:`Tools/scripts/cleanfuture.py` by Tim Peters, "
"automatically removes obsolete ``__future__`` statements from Python source "
"code."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:1189
msgid ""
"An additional *flags* argument has been added to the built-in function :func:"
"`compile`, so the behaviour of ``__future__`` statements can now be "
"correctly observed in simulated shells, such as those presented by IDLE and "
"other development environments. This is described in :pep:`264`. "
"(Contributed by Michael Hudson.)"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:1195
msgid ""
"The new license introduced with Python 1.6 wasn't GPL-compatible. This is "
"fixed by some minor textual changes to the 2.2 license, so it's now legal to "
"embed Python inside a GPLed program again. Note that Python itself is not "
"GPLed, but instead is under a license that's essentially equivalent to the "
"BSD license, same as it always was. The license changes were also applied "
"to the Python 2.0.1 and 2.1.1 releases."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:1202
msgid ""
"When presented with a Unicode filename on Windows, Python will now convert "
"it to an MBCS encoded string, as used by the Microsoft file APIs. As MBCS "
"is explicitly used by the file APIs, Python's choice of ASCII as the default "
"encoding turns out to be an annoyance. On Unix, the locale's character set "
"is used if :func:`locale.nl_langinfo(CODESET)` is available. (Windows "
"support was contributed by Mark Hammond with assistance from Marc-André "
"Lemburg. Unix support was added by Martin von Löwis.)"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:1210
msgid ""
"Large file support is now enabled on Windows. (Contributed by Tim Peters.)"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:1212
msgid ""
"The :file:`Tools/scripts/ftpmirror.py` script now parses a :file:`.netrc` "
"file, if you have one. (Contributed by Mike Romberg.)"
msgstr ""
# 6548f20ef6194efe88649daa6b5ff54c
#: ../src/Doc/whatsnew/2.2.rst:1215
msgid ""
"Some features of the object returned by the :func:`xrange` function are now "
"deprecated, and trigger warnings when they're accessed; they'll disappear in "
"Python 2.3. :class:`xrange` objects tried to pretend they were full sequence "
"types by supporting slicing, sequence multiplication, and the :keyword:`in` "
"operator, but these features were rarely used and therefore buggy. The :"
"meth:`tolist` method and the :attr:`start`, :attr:`stop`, and :attr:`step` "
"attributes are also being deprecated. At the C level, the fourth argument "
"to the :c:func:`PyRange_New` function, ``repeat``, has also been deprecated."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:1224
msgid ""
"There were a bunch of patches to the dictionary implementation, mostly to "
"fix potential core dumps if a dictionary contains objects that sneakily "
"changed their hash value, or mutated the dictionary they were contained in. "
"For a while python-dev fell into a gentle rhythm of Michael Hudson finding a "
"case that dumped core, Tim Peters fixing the bug, Michael finding another "
"case, and round and round it went."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:1231
msgid ""
"On Windows, Python can now be compiled with Borland C thanks to a number of "
"patches contributed by Stephen Hansen, though the result isn't fully "
"functional yet. (But this *is* progress...)"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:1235
msgid ""
"Another Windows enhancement: Wise Solutions generously offered PythonLabs "
"use of their InstallerMaster 8.1 system. Earlier PythonLabs Windows "
"installers used Wise 5.0a, which was beginning to show its age. (Packaged "
"up by Tim Peters.)"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:1239
msgid ""
"Files ending in ``.pyw`` can now be imported on Windows. ``.pyw`` is a "
"Windows-only thing, used to indicate that a script needs to be run using "
"PYTHONW.EXE instead of PYTHON.EXE in order to prevent a DOS console from "
"popping up to display the output. This patch makes it possible to import "
"such scripts, in case they're also usable as modules. (Implemented by David "
"Bolen.)"
msgstr ""
# 54ebe9e2f17d4af38f80d8c8f91897a3
#: ../src/Doc/whatsnew/2.2.rst:1245
msgid ""
"On platforms where Python uses the C :c:func:`dlopen` function to load "
"extension modules, it's now possible to set the flags used by :c:func:"
"`dlopen` using the :func:`sys.getdlopenflags` and :func:`sys.setdlopenflags` "
"functions. (Contributed by Bram Stolk.)"
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:1250
msgid ""
"The :func:`pow` built-in function no longer supports 3 arguments when "
"floating-point numbers are supplied. ``pow(x, y, z)`` returns ``(x**y) % "
"z``, but this is never useful for floating point numbers, and the final "
"result varies unpredictably depending on the platform. A call such as "
"``pow(2.0, 8.0, 7.0)`` will now raise a :exc:`TypeError` exception."
msgstr ""
#: ../src/Doc/whatsnew/2.2.rst:1262
msgid ""
"The author would like to thank the following people for offering "
"suggestions, corrections and assistance with various drafts of this article: "
"Fred Bremmer, Keith Briggs, Andrew Dalke, Fred L. Drake, Jr., Carel "
"Fellinger, David Goodger, Mark Hammond, Stephen Hansen, Michael Hudson, Jack "
"Jansen, Marc-André Lemburg, Martin von Löwis, Fredrik Lundh, Michael McLay, "
"Nick Mathewson, Paul Moore, Gustavo Niemeyer, Don O'Donnell, Joonas "
"Paalasma, Tim Peters, Jens Quade, Tom Reinhardt, Neil Schemenauer, Guido van "
"Rossum, Greg Ward, Edward Welbourne."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:3
msgid "What's New in Python 2.3"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:11
msgid ""
"This article explains the new features in Python 2.3. Python 2.3 was "
"released on July 29, 2003."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:14
msgid ""
"The main themes for Python 2.3 are polishing some of the features added in "
"2.2, adding various small but useful enhancements to the core language, and "
"expanding the standard library. The new object model introduced in the "
"previous version has benefited from 18 months of bugfixes and from "
"optimization efforts that have improved the performance of new-style "
"classes. A few new built-in functions have been added such as :func:`sum` "
"and :func:`enumerate`. The :keyword:`in` operator can now be used for "
"substring searches (e.g. ``\"ab\" in \"abc\"`` returns :const:`True`)."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:23
msgid ""
"Some of the many new library features include Boolean, set, heap, and date/"
"time data types, the ability to import modules from ZIP-format archives, "
"metadata support for the long-awaited Python catalog, an updated version of "
"IDLE, and modules for logging messages, wrapping text, parsing CSV files, "
"processing command-line options, using BerkeleyDB databases... the list of "
"new and enhanced modules is lengthy."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:30
msgid ""
"This article doesn't attempt to provide a complete specification of the new "
"features, but instead provides a convenient overview. For full details, you "
"should refer to the documentation for Python 2.3, such as the Python Library "
"Reference and the Python Reference Manual. If you want to understand the "
"complete implementation and design rationale, refer to the PEP for a "
"particular new feature."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:41
msgid "PEP 218: A Standard Set Datatype"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:43
msgid ""
"The new :mod:`sets` module contains an implementation of a set datatype. "
"The :class:`Set` class is for mutable sets, sets that can have members added "
"and removed. The :class:`ImmutableSet` class is for sets that can't be "
"modified, and instances of :class:`ImmutableSet` can therefore be used as "
"dictionary keys. Sets are built on top of dictionaries, so the elements "
"within a set must be hashable."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:50
msgid "Here's a simple example::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:66
msgid ""
"The union and intersection of sets can be computed with the :meth:`union` "
"and :meth:`intersection` methods; an alternative notation uses the bitwise "
"operators ``&`` and ``|``. Mutable sets also have in-place versions of these "
"methods, :meth:`union_update` and :meth:`intersection_update`. ::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:86
msgid ""
"It's also possible to take the symmetric difference of two sets. This is "
"the set of all elements in the union that aren't in the intersection. "
"Another way of putting it is that the symmetric difference contains all "
"elements that are in exactly one set. Again, there's an alternative "
"notation (``^``), and an in- place version with the ungainly name :meth:"
"`symmetric_difference_update`. ::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:100
msgid ""
"There are also :meth:`issubset` and :meth:`issuperset` methods for checking "
"whether one set is a subset or superset of another::"
msgstr ""
# 604b3b4bcd844c668b95e251f997a68c
# 11e6a4ca065d42759a448502eb06b5ef
#: ../src/Doc/whatsnew/2.3.rst:116 ../src/Doc/whatsnew/2.4.rst:82
msgid ":pep:`218` - Adding a Built-In Set Object Type"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:117
msgid ""
"PEP written by Greg V. Wilson. Implemented by Greg V. Wilson, Alex Martelli, "
"and GvR."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:128
msgid ""
"In Python 2.2, generators were added as an optional feature, to be enabled "
"by a ``from __future__ import generators`` directive. In 2.3 generators no "
"longer need to be specially enabled, and are now always present; this means "
"that :keyword:`yield` is now always a keyword. The rest of this section is "
"a copy of the description of generators from the \"What's New in Python "
"2.2\" document; if you read it back when Python 2.2 came out, you can skip "
"the rest of this section."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:136
msgid ""
"You're doubtless familiar with how function calls work in Python or C. When "
"you call a function, it gets a private namespace where its local variables "
"are created. When the function reaches a :keyword:`return` statement, the "
"local variables are destroyed and the resulting value is returned to the "
"caller. A later call to the same function will get a fresh new set of local "
"variables. But, what if the local variables weren't thrown away on exiting a "
"function? What if you could later resume the function where it left off? "
"This is what generators provide; they can be thought of as resumable "
"functions."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:151
msgid ""
"A new keyword, :keyword:`yield`, was introduced for generators. Any "
"function containing a :keyword:`yield` statement is a generator function; "
"this is detected by Python's bytecode compiler which compiles the function "
"specially as a result."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:156
msgid ""
"When you call a generator function, it doesn't return a single value; "
"instead it returns a generator object that supports the iterator protocol. "
"On executing the :keyword:`yield` statement, the generator outputs the value "
"of ``i``, similar to a :keyword:`return` statement. The big difference "
"between :keyword:`yield` and a :keyword:`return` statement is that on "
"reaching a :keyword:`yield` the generator's state of execution is suspended "
"and local variables are preserved. On the next call to the generator's ``."
"next()`` method, the function will resume executing immediately after the :"
"keyword:`yield` statement. (For complicated reasons, the :keyword:`yield` "
"statement isn't allowed inside the :keyword:`try` block of a :keyword:"
"`try`...\\ :keyword:`finally` statement; read :pep:`255` for a full "
"explanation of the interaction between :keyword:`yield` and exceptions.)"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:236
msgid ""
"Python doesn't go nearly as far as Icon in adopting generators as a central "
"concept. Generators are considered part of the core Python language, but "
"learning or using them isn't compulsory; if they don't solve any problems "
"that you have, feel free to ignore them. One novel feature of Python's "
"interface as compared to Icon's is that a generator's state is represented "
"as a concrete object (the iterator) that can be passed around to other "
"functions or stored in a data structure."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:257
msgid "PEP 263: Source Code Encodings"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:259
msgid ""
"Python source files can now be declared as being in different character set "
"encodings. Encodings are declared by including a specially formatted "
"comment in the first or second line of the source file. For example, a "
"UTF-8 file can be declared with::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:267
msgid ""
"Without such an encoding declaration, the default encoding used is 7-bit "
"ASCII. Executing or importing modules that contain string literals with 8-"
"bit characters and have no encoding declaration will result in a :exc:"
"`DeprecationWarning` being signalled by Python 2.3; in 2.4 this will be a "
"syntax error."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:273
msgid ""
"The encoding declaration only affects Unicode string literals, which will be "
"converted to Unicode using the specified encoding. Note that Python "
"identifiers are still restricted to ASCII characters, so you can't have "
"variable names that use characters outside of the usual alphanumerics."
msgstr ""
# 87105120b9b04b08aeb7070f9bd4eddd
#: ../src/Doc/whatsnew/2.3.rst:281
msgid ":pep:`263` - Defining Python Source Code Encodings"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:282
msgid ""
"Written by Marc-André Lemburg and Martin von Löwis; implemented by Suzuki "
"Hisao and Martin von Löwis."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:289
msgid "PEP 273: Importing Modules from ZIP Archives"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:291
msgid ""
"The new :mod:`zipimport` module adds support for importing modules from a "
"ZIP- format archive. You don't need to import the module explicitly; it "
"will be automatically imported if a ZIP archive's filename is added to ``sys."
"path``. For example::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:312
msgid ""
"An entry in ``sys.path`` can now be the filename of a ZIP archive. The ZIP "
"archive can contain any kind of files, but only files named :file:`\\*.py`, :"
"file:`\\*.pyc`, or :file:`\\*.pyo` can be imported. If an archive only "
"contains :file:`\\*.py` files, Python will not attempt to modify the archive "
"by adding the corresponding :file:`\\*.pyc` file, meaning that if a ZIP "
"archive doesn't contain :file:`\\*.pyc` files, importing may be rather slow."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:319
msgid ""
"A path within the archive can also be specified to only import from a "
"subdirectory; for example, the path :file:`/tmp/example.zip/lib/` would only "
"import from the :file:`lib/` subdirectory within the archive."
msgstr ""
# ab4efd1d85b541e5850ddd4331e86888
#: ../src/Doc/whatsnew/2.3.rst:328
msgid ":pep:`273` - Import Modules from Zip Archives"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:327
msgid ""
"Written by James C. Ahlstrom, who also provided an implementation. Python "
"2.3 follows the specification in :pep:`273`, but uses an implementation "
"written by Just van Rossum that uses the import hooks described in :pep:"
"`302`. See section :ref:`section-pep302` for a description of the new import "
"hooks."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:336
msgid "PEP 277: Unicode file name support for Windows NT"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:338
msgid ""
"On Windows NT, 2000, and XP, the system stores file names as Unicode "
"strings. Traditionally, Python has represented file names as byte strings, "
"which is inadequate because it renders some file names inaccessible."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:342
msgid ""
"Python now allows using arbitrary Unicode strings (within the limitations of "
"the file system) for all functions that expect file names, most notably the :"
"func:`open` built-in function. If a Unicode string is passed to :func:`os."
"listdir`, Python now returns a list of Unicode strings. A new function, :"
"func:`os.getcwdu`, returns the current directory as a Unicode string."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:348
msgid ""
"Byte strings still work as file names, and on Windows Python will "
"transparently convert them to Unicode using the ``mbcs`` encoding."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:351
msgid ""
"Other systems also allow Unicode strings as file names but convert them to "
"byte strings before passing them to the system, which can cause a :exc:"
"`UnicodeError` to be raised. Applications can test whether arbitrary Unicode "
"strings are supported as file names by checking :attr:`os.path."
"supports_unicode_filenames`, a Boolean value."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:357
msgid "Under MacOS, :func:`os.listdir` may now return Unicode filenames."
msgstr ""
# 610fef83566448148cedead9029ac616
#: ../src/Doc/whatsnew/2.3.rst:362
msgid ":pep:`277` - Unicode file name support for Windows NT"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:363
msgid ""
"Written by Neil Hodgson; implemented by Neil Hodgson, Martin von Löwis, and "
"Mark Hammond."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:373
msgid "PEP 278: Universal Newline Support"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:375
msgid ""
"The three major operating systems used today are Microsoft Windows, Apple's "
"Macintosh OS, and the various Unix derivatives. A minor irritation of "
"cross- platform work is that these three platforms all use different "
"characters to mark the ends of lines in text files. Unix uses the linefeed "
"(ASCII character 10), MacOS uses the carriage return (ASCII character 13), "
"and Windows uses a two-character sequence of a carriage return plus a "
"newline."
msgstr ""
# 50aeb53f8c64462dad7176949cb09f35
#: ../src/Doc/whatsnew/2.3.rst:382
msgid ""
"Python's file objects can now support end of line conventions other than the "
"one followed by the platform on which Python is running. Opening a file with "
"the mode ``'U'`` or ``'rU'`` will open a file for reading in :term:"
"`universal newlines` mode. All three line ending conventions will be "
"translated to a ``'\\n'`` in the strings returned by the various file "
"methods such as :meth:`read` and :meth:`readline`."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:389
msgid ""
"Universal newline support is also used when importing modules and when "
"executing a file with the :func:`execfile` function. This means that Python "
"modules can be shared between all three operating systems without needing to "
"convert the line-endings."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:394
msgid ""
"This feature can be disabled when compiling Python by specifying the :option:"
"`--without-universal-newlines` switch when running Python's :program:"
"`configure` script."
msgstr ""
# bdc88e9c637544f98742013e850ae401
#: ../src/Doc/whatsnew/2.3.rst:400
msgid ":pep:`278` - Universal Newline Support"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:402
msgid "Written and implemented by Jack Jansen."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:410
msgid "PEP 279: enumerate()"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:412
msgid ""
"A new built-in function, :func:`enumerate`, will make certain loops a bit "
"clearer. ``enumerate(thing)``, where *thing* is either an iterator or a "
"sequence, returns a iterator that will return ``(0, thing[0])``, ``(1, "
"thing[1])``, ``(2, thing[2])``, and so forth."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:417
msgid "A common idiom to change every element of a list looks like this::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:424
msgid "This can be rewritten using :func:`enumerate` as::"
msgstr ""
# 1d98608f86004c12b0eca363b9511dd6
#: ../src/Doc/whatsnew/2.3.rst:432
msgid ":pep:`279` - The enumerate() built-in function"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:434
msgid "Written and implemented by Raymond D. Hettinger."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:440
msgid "PEP 282: The logging Package"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:442
msgid ""
"A standard package for writing logs, :mod:`logging`, has been added to "
"Python 2.3. It provides a powerful and flexible mechanism for generating "
"logging output which can then be filtered and processed in various ways. A "
"configuration file written in a standard format can be used to control the "
"logging behavior of a program. Python includes handlers that will write log "
"records to standard error or to a file or socket, send them to the system "
"log, or even e-mail them to a particular address; of course, it's also "
"possible to write your own handler classes."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:451
msgid ""
"The :class:`Logger` class is the primary class. Most application code will "
"deal with one or more :class:`Logger` objects, each one used by a particular "
"subsystem of the application. Each :class:`Logger` is identified by a name, "
"and names are organized into a hierarchy using ``.`` as the component "
"separator. For example, you might have :class:`Logger` instances named "
"``server``, ``server.auth`` and ``server.network``. The latter two "
"instances are below ``server`` in the hierarchy. This means that if you "
"turn up the verbosity for ``server`` or direct ``server`` messages to a "
"different handler, the changes will also apply to records logged to ``server."
"auth`` and ``server.network``. There's also a root :class:`Logger` that's "
"the parent of all other loggers."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:462
msgid ""
"For simple uses, the :mod:`logging` package contains some convenience "
"functions that always use the root log::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:473 ../src/Doc/whatsnew/2.3.rst:498
#: ../src/Doc/whatsnew/2.6.rst:638
msgid "This produces the following output::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:479
msgid ""
"In the default configuration, informational and debugging messages are "
"suppressed and the output is sent to standard error. You can enable the "
"display of informational and debugging messages by calling the :meth:"
"`setLevel` method on the root logger."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:484
msgid ""
"Notice the :func:`warning` call's use of string formatting operators; all of "
"the functions for logging messages take the arguments ``(msg, arg1, "
"arg2, ...)`` and log the string resulting from ``msg % (arg1, arg2, ...)``."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:488
msgid ""
"There's also an :func:`exception` function that records the most recent "
"traceback. Any of the other functions will also record the traceback if you "
"specify a true value for the keyword argument *exc_info*. ::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:506
msgid ""
"Slightly more advanced programs will use a logger other than the root "
"logger. The :func:`getLogger(name)` function is used to get a particular "
"log, creating it if it doesn't exist yet. :func:`getLogger(None)` returns "
"the root logger. ::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:517
msgid ""
"Log records are usually propagated up the hierarchy, so a message logged to "
"``server.auth`` is also seen by ``server`` and ``root``, but a :class:"
"`Logger` can prevent this by setting its :attr:`propagate` attribute to :"
"const:`False`."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:521
msgid ""
"There are more classes provided by the :mod:`logging` package that can be "
"customized. When a :class:`Logger` instance is told to log a message, it "
"creates a :class:`LogRecord` instance that is sent to any number of "
"different :class:`Handler` instances. Loggers and handlers can also have an "
"attached list of filters, and each filter can cause the :class:`LogRecord` "
"to be ignored or can modify the record before passing it along. When "
"they're finally output, :class:`LogRecord` instances are converted to text "
"by a :class:`Formatter` class. All of these classes can be replaced by your "
"own specially-written classes."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:531
msgid ""
"With all of these features the :mod:`logging` package should provide enough "
"flexibility for even the most complicated applications. This is only an "
"incomplete overview of its features, so please see the package's reference "
"documentation for all of the details. Reading :pep:`282` will also be "
"helpful."
msgstr ""
# f3b37dd75b2447f981ace77b4440ac4f
#: ../src/Doc/whatsnew/2.3.rst:538
msgid ":pep:`282` - A Logging System"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:540
msgid "Written by Vinay Sajip and Trent Mick; implemented by Vinay Sajip."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:548
msgid "PEP 285: A Boolean Type"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:550
msgid ""
"A Boolean type was added to Python 2.3. Two new constants were added to "
"the :mod:`__builtin__` module, :const:`True` and :const:`False`. (:const:"
"`True` and :const:`False` constants were added to the built-ins in Python "
"2.2.1, but the 2.2.1 versions are simply set to integer values of 1 and 0 "
"and aren't a different type.)"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:556
msgid ""
"The type object for this new type is named :class:`bool`; the constructor "
"for it takes any Python value and converts it to :const:`True` or :const:"
"`False`. ::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:568
msgid ""
"Most of the standard library modules and built-in functions have been "
"changed to return Booleans. ::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:579
msgid ""
"Python's Booleans were added with the primary goal of making code clearer. "
"For example, if you're reading a function and encounter the statement "
"``return 1``, you might wonder whether the ``1`` represents a Boolean truth "
"value, an index, or a coefficient that multiplies some other quantity. If "
"the statement is ``return True``, however, the meaning of the return value "
"is quite clear."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:585
msgid ""
"Python's Booleans were *not* added for the sake of strict type-checking. A "
"very strict language such as Pascal would also prevent you performing "
"arithmetic with Booleans, and would require that the expression in an :"
"keyword:`if` statement always evaluate to a Boolean result. Python is not "
"this strict and never will be, as :pep:`285` explicitly says. This means "
"you can still use any expression in an :keyword:`if` statement, even ones "
"that evaluate to a list or tuple or some random object. The Boolean type is "
"a subclass of the :class:`int` class so that arithmetic using a Boolean "
"still works. ::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:603
msgid ""
"To sum up :const:`True` and :const:`False` in a sentence: they're "
"alternative ways to spell the integer values 1 and 0, with the single "
"difference that :func:`str` and :func:`repr` return the strings ``'True'`` "
"and ``'False'`` instead of ``'1'`` and ``'0'``."
msgstr ""
# 9ddd0fbf24fd45c1ae4fbe8bcfa4c4eb
#: ../src/Doc/whatsnew/2.3.rst:610
msgid ":pep:`285` - Adding a bool type"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:612
msgid "Written and implemented by GvR."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:618
msgid "PEP 293: Codec Error Handling Callbacks"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:620
msgid ""
"When encoding a Unicode string into a byte string, unencodable characters "
"may be encountered. So far, Python has allowed specifying the error "
"processing as either \"strict\" (raising :exc:`UnicodeError`), \"ignore"
"\" (skipping the character), or \"replace\" (using a question mark in the "
"output string), with \"strict\" being the default behavior. It may be "
"desirable to specify alternative processing of such errors, such as "
"inserting an XML character reference or HTML entity reference into the "
"converted string."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:628
msgid ""
"Python now has a flexible framework to add different processing strategies. "
"New error handlers can be added with :func:`codecs.register_error`, and "
"codecs then can access the error handler with :func:`codecs.lookup_error`. "
"An equivalent C API has been added for codecs written in C. The error "
"handler gets the necessary state information such as the string being "
"converted, the position in the string where the error was detected, and the "
"target encoding. The handler can then either raise an exception or return a "
"replacement string."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:636
msgid ""
"Two additional error handlers have been implemented using this framework: "
"\"backslashreplace\" uses Python backslash quoting to represent unencodable "
"characters and \"xmlcharrefreplace\" emits XML character references."
msgstr ""
# 51fe618a138a46e38b3c0db64cca6943
#: ../src/Doc/whatsnew/2.3.rst:642
msgid ":pep:`293` - Codec Error Handling Callbacks"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:644
msgid "Written and implemented by Walter Dörwald."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:652
msgid "PEP 301: Package Index and Metadata for Distutils"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:654
msgid ""
"Support for the long-requested Python catalog makes its first appearance in "
"2.3."
msgstr ""
# a0506e84af164b049d52c35bd7d12336
#: ../src/Doc/whatsnew/2.3.rst:656
msgid ""
"The heart of the catalog is the new Distutils :command:`register` command. "
"Running ``python setup.py register`` will collect the metadata describing a "
"package, such as its name, version, maintainer, description, &c., and send "
"it to a central catalog server. The resulting catalog is available from "
"https://pypi.python.org/pypi."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:662
msgid ""
"To make the catalog a bit more useful, a new optional *classifiers* keyword "
"argument has been added to the Distutils :func:`setup` function. A list of "
"`Trove <http://catb.org/~esr/trove/>`_-style strings can be supplied to help "
"classify the software."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:667
msgid ""
"Here's an example :file:`setup.py` with classifiers, written to be "
"compatible with older versions of the Distutils::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:686
msgid ""
"The full list of classifiers can be obtained by running ``python setup.py "
"register --list-classifiers``."
msgstr ""
# dfc0381a3fb547379def8eb100921a2a
#: ../src/Doc/whatsnew/2.3.rst:691
msgid ":pep:`301` - Package Index and Metadata for Distutils"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:693
msgid "Written and implemented by Richard Jones."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:701
msgid "PEP 302: New Import Hooks"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:703
msgid ""
"While it's been possible to write custom import hooks ever since the :mod:"
"`ihooks` module was introduced in Python 1.3, no one has ever been really "
"happy with it because writing new import hooks is difficult and messy. "
"There have been various proposed alternatives such as the :mod:`imputil` "
"and :mod:`iu` modules, but none of them has ever gained much acceptance, and "
"none of them were easily usable from C code."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:710
msgid ""
":pep:`302` borrows ideas from its predecessors, especially from Gordon "
"McMillan's :mod:`iu` module. Three new items are added to the :mod:`sys` "
"module:"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:714
msgid ""
"``sys.path_hooks`` is a list of callable objects; most often they'll be "
"classes. Each callable takes a string containing a path and either returns "
"an importer object that will handle imports from this path or raises an :exc:"
"`ImportError` exception if it can't handle this path."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:719
msgid ""
"``sys.path_importer_cache`` caches importer objects for each path, so ``sys."
"path_hooks`` will only need to be traversed once for each path."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:722
msgid ""
"``sys.meta_path`` is a list of importer objects that will be traversed "
"before ``sys.path`` is checked. This list is initially empty, but user code "
"can add objects to it. Additional built-in and frozen modules can be "
"imported by an object added to this list."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:727
msgid ""
"Importer objects must have a single method, :meth:`find_module(fullname, "
"path=None)`. *fullname* will be a module or package name, e.g. ``string`` "
"or ``distutils.core``. :meth:`find_module` must return a loader object that "
"has a single method, :meth:`load_module(fullname)`, that creates and returns "
"the corresponding module object."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:733
msgid ""
"Pseudo-code for Python's new import logic, therefore, looks something like "
"this (simplified a bit; see :pep:`302` for the full details)::"
msgstr ""
# c5b98885f39540dfaae7f2f0d5f7a98b
#: ../src/Doc/whatsnew/2.3.rst:757
msgid ":pep:`302` - New Import Hooks"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:759
msgid ""
"Written by Just van Rossum and Paul Moore. Implemented by Just van Rossum."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:767
msgid "PEP 305: Comma-separated Files"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:769
msgid ""
"Comma-separated files are a format frequently used for exporting data from "
"databases and spreadsheets. Python 2.3 adds a parser for comma-separated "
"files."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:772
msgid "Comma-separated format is deceptively simple at first glance::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:776
msgid ""
"Read a line and call ``line.split(',')``: what could be simpler? But toss in "
"string data that can contain commas, and things get more complicated::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:781
msgid ""
"A big ugly regular expression can parse this, but using the new :mod:`csv` "
"package is much simpler::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:791
msgid ""
"The :func:`reader` function takes a number of different options. The field "
"separator isn't limited to the comma and can be changed to any character, "
"and so can the quoting and line-ending characters."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:795
msgid ""
"Different dialects of comma-separated files can be defined and registered; "
"currently there are two dialects, both used by Microsoft Excel. A separate :"
"class:`csv.writer` class will generate comma-separated files from a "
"succession of tuples or lists, quoting strings that contain the delimiter."
msgstr ""
# 4b1e93a4f1d3443d8c93be195dad437a
#: ../src/Doc/whatsnew/2.3.rst:803
msgid ":pep:`305` - CSV File API"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:804
msgid ""
"Written and implemented by Kevin Altis, Dave Cole, Andrew McNamara, Skip "
"Montanaro, Cliff Wells."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:813
msgid "PEP 307: Pickle Enhancements"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:815
msgid ""
"The :mod:`pickle` and :mod:`cPickle` modules received some attention during "
"the 2.3 development cycle. In 2.2, new-style classes could be pickled "
"without difficulty, but they weren't pickled very compactly; :pep:`307` "
"quotes a trivial example where a new-style class results in a pickled string "
"three times longer than that for a classic class."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:821
msgid ""
"The solution was to invent a new pickle protocol. The :func:`pickle.dumps` "
"function has supported a text-or-binary flag for a long time. In 2.3, this "
"flag is redefined from a Boolean to an integer: 0 is the old text-mode "
"pickle format, 1 is the old binary format, and now 2 is a new 2.3-specific "
"format. A new constant, :const:`pickle.HIGHEST_PROTOCOL`, can be used to "
"select the fanciest protocol available."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:828
msgid ""
"Unpickling is no longer considered a safe operation. 2.2's :mod:`pickle` "
"provided hooks for trying to prevent unsafe classes from being unpickled "
"(specifically, a :attr:`__safe_for_unpickling__` attribute), but none of "
"this code was ever audited and therefore it's all been ripped out in 2.3. "
"You should not unpickle untrusted data in any version of Python."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:834
msgid ""
"To reduce the pickling overhead for new-style classes, a new interface for "
"customizing pickling was added using three special methods: :meth:"
"`__getstate__`, :meth:`__setstate__`, and :meth:`__getnewargs__`. Consult :"
"pep:`307` for the full semantics of these methods."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:839
msgid ""
"As a way to compress pickles yet further, it's now possible to use integer "
"codes instead of long strings to identify pickled classes. The Python "
"Software Foundation will maintain a list of standardized codes; there's also "
"a range of codes for private use. Currently no codes have been specified."
msgstr ""
# 7565ca9433644774ad46f41a5c80afc0
#: ../src/Doc/whatsnew/2.3.rst:846
msgid ":pep:`307` - Extensions to the pickle protocol"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:848
msgid "Written and implemented by Guido van Rossum and Tim Peters."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:856
msgid "Extended Slices"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:858
msgid ""
"Ever since Python 1.4, the slicing syntax has supported an optional third "
"\"step\" or \"stride\" argument. For example, these are all legal Python "
"syntax: ``L[1:10:2]``, ``L[:-1:1]``, ``L[::-1]``. This was added to Python "
"at the request of the developers of Numerical Python, which uses the third "
"argument extensively. However, Python's built-in list, tuple, and string "
"sequence types have never supported this feature, raising a :exc:`TypeError` "
"if you tried it. Michael Hudson contributed a patch to fix this shortcoming."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:866
msgid ""
"For example, you can now easily extract the elements of a list that have "
"even indexes::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:873
msgid ""
"Negative values also work to make a copy of the same list in reverse order::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:878
msgid "This also works for tuples, arrays, and strings::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:886
msgid ""
"If you have a mutable sequence such as a list or an array you can assign to "
"or delete an extended slice, but there are some differences between "
"assignment to extended and regular slices. Assignment to a regular slice "
"can be used to change the length of the sequence::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:898
msgid ""
"Extended slices aren't this flexible. When assigning to an extended slice, "
"the list on the right hand side of the statement must contain the same "
"number of items as the slice it is replacing::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:915
msgid "Deletion is more straightforward::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:926
msgid ""
"One can also now pass slice objects to the :meth:`__getitem__` methods of "
"the built-in sequences::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:932
msgid "Or use slice objects directly in subscripts::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:937
msgid ""
"To simplify implementing sequences that support extended slicing, slice "
"objects now have a method :meth:`indices(length)` which, given the length of "
"a sequence, returns a ``(start, stop, step)`` tuple that can be passed "
"directly to :func:`range`. :meth:`indices` handles omitted and out-of-bounds "
"indices in a manner consistent with regular slices (and this innocuous "
"phrase hides a welter of confusing details!). The method is intended to be "
"used like this::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:955
msgid ""
"From this example you can also see that the built-in :class:`slice` object "
"is now the type object for the slice type, and is no longer a function. "
"This is consistent with Python 2.2, where :class:`int`, :class:`str`, etc., "
"underwent the same change."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:964 ../src/Doc/whatsnew/2.4.rst:774
#: ../src/Doc/whatsnew/2.5.rst:973 ../src/Doc/whatsnew/2.6.rst:1481
#: ../src/Doc/whatsnew/2.7.rst:663
msgid "Other Language Changes"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:966
msgid ""
"Here are all of the changes that Python 2.3 makes to the core Python "
"language."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:968
msgid ""
"The :keyword:`yield` statement is now always a keyword, as described in "
"section :ref:`section-generators` of this document."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:971
msgid ""
"A new built-in function :func:`enumerate` was added, as described in "
"section :ref:`section-enumerate` of this document."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:974
msgid ""
"Two new constants, :const:`True` and :const:`False` were added along with "
"the built-in :class:`bool` type, as described in section :ref:`section-bool` "
"of this document."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:978
msgid ""
"The :func:`int` type constructor will now return a long integer instead of "
"raising an :exc:`OverflowError` when a string or floating-point number is "
"too large to fit into an integer. This can lead to the paradoxical result "
"that ``isinstance(int(expression), int)`` is false, but that seems unlikely "
"to cause problems in practice."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:984
msgid ""
"Built-in types now support the extended slicing syntax, as described in "
"section :ref:`section-slices` of this document."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:987
msgid ""
"A new built-in function, :func:`sum(iterable, start=0)`, adds up the "
"numeric items in the iterable object and returns their sum. :func:`sum` "
"only accepts numbers, meaning that you can't use it to concatenate a bunch "
"of strings. (Contributed by Alex Martelli.)"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:992
msgid ""
"``list.insert(pos, value)`` used to insert *value* at the front of the list "
"when *pos* was negative. The behaviour has now been changed to be "
"consistent with slice indexing, so when *pos* is -1 the value will be "
"inserted before the last element, and so forth."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:997
msgid ""
"``list.index(value)``, which searches for *value* within the list and "
"returns its index, now takes optional *start* and *stop* arguments to limit "
"the search to only part of the list."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1001
msgid ""
"Dictionaries have a new method, :meth:`pop(key[, *default*])`, that returns "
"the value corresponding to *key* and removes that key/value pair from the "
"dictionary. If the requested key isn't present in the dictionary, *default* "
"is returned if it's specified and :exc:`KeyError` raised if it isn't. ::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1023
msgid ""
"There's also a new class method, :meth:`dict.fromkeys(iterable, value)`, "
"that creates a dictionary with keys taken from the supplied iterator "
"*iterable* and all values set to *value*, defaulting to ``None``."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1027
msgid "(Patches contributed by Raymond Hettinger.)"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1029
msgid ""
"Also, the :func:`dict` constructor now accepts keyword arguments to simplify "
"creating small dictionaries::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1035
msgid "(Contributed by Just van Rossum.)"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1037
msgid ""
"The :keyword:`assert` statement no longer checks the ``__debug__`` flag, so "
"you can no longer disable assertions by assigning to ``__debug__``. Running "
"Python with the :option:`-O` switch will still generate code that doesn't "
"execute any assertions."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1042
msgid ""
"Most type objects are now callable, so you can use them to create new "
"objects such as functions, classes, and modules. (This means that the :mod:"
"`new` module can be deprecated in a future Python version, because you can "
"now use the type objects available in the :mod:`types` module.) For example, "
"you can create a new module object with the following code:"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1057
msgid ""
"A new warning, :exc:`PendingDeprecationWarning` was added to indicate "
"features which are in the process of being deprecated. The warning will "
"*not* be printed by default. To check for use of features that will be "
"deprecated in the future, supply :option:`-Walways::"
"PendingDeprecationWarning::` on the command line or use :func:`warnings."
"filterwarnings`."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1063
msgid ""
"The process of deprecating string-based exceptions, as in ``raise \"Error "
"occurred\"``, has begun. Raising a string will now trigger :exc:"
"`PendingDeprecationWarning`."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1067
msgid ""
"Using ``None`` as a variable name will now result in a :exc:`SyntaxWarning` "
"warning. In a future version of Python, ``None`` may finally become a "
"keyword."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1070
msgid ""
"The :meth:`xreadlines` method of file objects, introduced in Python 2.1, is "
"no longer necessary because files now behave as their own iterator. :meth:"
"`xreadlines` was originally introduced as a faster way to loop over all the "
"lines in a file, but now you can simply write ``for line in file_obj``. File "
"objects also have a new read-only :attr:`encoding` attribute that gives the "
"encoding used by the file; Unicode strings written to the file will be "
"automatically converted to bytes using the given encoding."
msgstr ""
# 43036fa0ad6a4af28c7cf3818513db8a
#: ../src/Doc/whatsnew/2.3.rst:1078
msgid ""
"The method resolution order used by new-style classes has changed, though "
"you'll only notice the difference if you have a really complicated "
"inheritance hierarchy. Classic classes are unaffected by this change. "
"Python 2.2 originally used a topological sort of a class's ancestors, but "
"2.3 now uses the C3 algorithm as described in the paper `\"A Monotonic "
"Superclass Linearization for Dylan\" <http://www.webcom.com/haahr/dylan/"
"linearization-oopsla96.html>`_. To understand the motivation for this "
"change, read Michele Simionato's article `\"Python 2.3 Method Resolution "
"Order\" <https://www.python.org/2.3/mro.html>`_, or read the thread on "
"python-dev starting with the message at https://mail.python.org/pipermail/"
"python-dev/2002-October/029035.html. Samuele Pedroni first pointed out the "
"problem and also implemented the fix by coding the C3 algorithm."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1091
msgid ""
"Python runs multithreaded programs by switching between threads after "
"executing N bytecodes. The default value for N has been increased from 10 "
"to 100 bytecodes, speeding up single-threaded applications by reducing the "
"switching overhead. Some multithreaded applications may suffer slower "
"response time, but that's easily fixed by setting the limit back to a lower "
"number using :func:`sys.setcheckinterval(N)`. The limit can be retrieved "
"with the new :func:`sys.getcheckinterval` function."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1099
msgid ""
"One minor but far-reaching change is that the names of extension types "
"defined by the modules included with Python now contain the module and a "
"``'.'`` in front of the type name. For example, in Python 2.2, if you "
"created a socket and printed its :attr:`__class__`, you'd get this output::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1108
msgid "In 2.3, you get this::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1113
msgid ""
"One of the noted incompatibilities between old- and new-style classes has "
"been removed: you can now assign to the :attr:`__name__` and :attr:"
"`__bases__` attributes of new-style classes. There are some restrictions on "
"what can be assigned to :attr:`__bases__` along the lines of those relating "
"to assigning to an instance's :attr:`__class__` attribute."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1123
msgid "String Changes"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1125
msgid ""
"The :keyword:`in` operator now works differently for strings. Previously, "
"when evaluating ``X in Y`` where *X* and *Y* are strings, *X* could only be "
"a single character. That's now changed; *X* can be a string of any length, "
"and ``X in Y`` will return :const:`True` if *X* is a substring of *Y*. If "
"*X* is the empty string, the result is always :const:`True`. ::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1138
msgid ""
"Note that this doesn't tell you where the substring starts; if you need that "
"information, use the :meth:`find` string method."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1141
msgid ""
"The :meth:`strip`, :meth:`lstrip`, and :meth:`rstrip` string methods now "
"have an optional argument for specifying the characters to strip. The "
"default is still to remove all whitespace characters::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1155
msgid "(Suggested by Simon Brunning and implemented by Walter Dörwald.)"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1157
msgid ""
"The :meth:`startswith` and :meth:`endswith` string methods now accept "
"negative numbers for the *start* and *end* parameters."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1160
msgid ""
"Another new string method is :meth:`zfill`, originally a function in the :"
"mod:`string` module. :meth:`zfill` pads a numeric string with zeros on the "
"left until it's the specified width. Note that the ``%`` operator is still "
"more flexible and powerful than :meth:`zfill`. ::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1172
msgid "(Contributed by Walter Dörwald.)"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1174
msgid ""
"A new type object, :class:`basestring`, has been added. Both 8-bit strings "
"and Unicode strings inherit from this type, so ``isinstance(obj, "
"basestring)`` will return :const:`True` for either kind of string. It's a "
"completely abstract type, so you can't create :class:`basestring` instances."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1179
msgid ""
"Interned strings are no longer immortal and will now be garbage-collected in "
"the usual way when the only reference to them is from the internal "
"dictionary of interned strings. (Implemented by Oren Tirosh.)"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1187 ../src/Doc/whatsnew/2.4.rst:933
#: ../src/Doc/whatsnew/2.5.rst:1138 ../src/Doc/whatsnew/2.6.rst:1689
#: ../src/Doc/whatsnew/2.7.rst:913
msgid "Optimizations"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1189
msgid ""
"The creation of new-style class instances has been made much faster; they're "
"now faster than classic classes!"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1192
msgid ""
"The :meth:`sort` method of list objects has been extensively rewritten by "
"Tim Peters, and the implementation is significantly faster."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1195
msgid ""
"Multiplication of large long integers is now much faster thanks to an "
"implementation of Karatsuba multiplication, an algorithm that scales better "
"than the O(n\\*n) required for the grade-school multiplication algorithm. "
"(Original patch by Christopher A. Craig, and significantly reworked by Tim "
"Peters.)"
msgstr ""
# 54ce6b34dadf4c1ea783fe916755dff8
#: ../src/Doc/whatsnew/2.3.rst:1200
msgid ""
"The ``SET_LINENO`` opcode is now gone. This may provide a small speed "
"increase, depending on your compiler's idiosyncrasies. See section :ref:"
"`section-other` for a longer explanation. (Removed by Michael Hudson.)"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1204
msgid ""
":func:`xrange` objects now have their own iterator, making ``for i in "
"xrange(n)`` slightly faster than ``for i in range(n)``. (Patch by Raymond "
"Hettinger.)"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1208
msgid ""
"A number of small rearrangements have been made in various hotspots to "
"improve performance, such as inlining a function or removing some code. "
"(Implemented mostly by GvR, but lots of people have contributed single "
"changes.)"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1212
msgid ""
"The net result of the 2.3 optimizations is that Python 2.3 runs the pystone "
"benchmark around 25% faster than Python 2.2."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1219 ../src/Doc/whatsnew/2.4.rst:990
msgid "New, Improved, and Deprecated Modules"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1221 ../src/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 ""
#: ../src/Doc/whatsnew/2.3.rst:1226
msgid ""
"The :mod:`array` module now supports arrays of Unicode characters using the "
"``'u'`` format character. Arrays also now support using the ``+=`` "
"assignment operator to add another array's contents, and the ``*=`` "
"assignment operator to repeat an array. (Contributed by Jason Orendorff.)"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1231
msgid ""
"The :mod:`bsddb` module has been replaced by version 4.1.6 of the `PyBSDDB "
"<http://pybsddb.sourceforge.net>`_ package, providing a more complete "
"interface to the transactional features of the BerkeleyDB library."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1235
msgid ""
"The old version of the module has been renamed to :mod:`bsddb185` and is no "
"longer built automatically; you'll have to edit :file:`Modules/Setup` to "
"enable it. Note that the new :mod:`bsddb` package is intended to be "
"compatible with the old module, so be sure to file bugs if you discover any "
"incompatibilities. When upgrading to Python 2.3, if the new interpreter is "
"compiled with a new version of the underlying BerkeleyDB library, you will "
"almost certainly have to convert your database files to the new version. "
"You can do this fairly easily with the new scripts :file:`db2pickle.py` and :"
"file:`pickle2db.py` which you will find in the distribution's :file:`Tools/"
"scripts` directory. If you've already been using the PyBSDDB package and "
"importing it as :mod:`bsddb3`, you will have to change your ``import`` "
"statements to import it as :mod:`bsddb`."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1247
msgid ""
"The new :mod:`bz2` module is an interface to the bz2 data compression "
"library. bz2-compressed data is usually smaller than corresponding :mod:"
"`zlib`\\ -compressed data. (Contributed by Gustavo Niemeyer.)"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1251
msgid ""
"A set of standard date/time types has been added in the new :mod:`datetime` "
"module. See the following section for more details."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1254
msgid ""
"The Distutils :class:`Extension` class now supports an extra constructor "
"argument named *depends* for listing additional source files that an "
"extension depends on. This lets Distutils recompile the module if any of "
"the dependency files are modified. For example, if :file:`sampmodule.c` "
"includes the header file :file:`sample.h`, you would create the :class:"
"`Extension` object like this::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1265
msgid ""
"Modifying :file:`sample.h` would then cause the module to be recompiled. "
"(Contributed by Jeremy Hylton.)"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1268
msgid ""
"Other minor changes to Distutils: it now checks for the :envvar:`CC`, :"
"envvar:`CFLAGS`, :envvar:`CPP`, :envvar:`LDFLAGS`, and :envvar:`CPPFLAGS` "
"environment variables, using them to override the settings in Python's "
"configuration (contributed by Robert Weber)."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1273
msgid ""
"Previously the :mod:`doctest` module would only search the docstrings of "
"public methods and functions for test cases, but it now also examines "
"private ones as well. The :func:`DocTestSuite(` function creates a :class:"
"`unittest.TestSuite` object from a set of :mod:`doctest` tests."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1278
msgid ""
"The new :func:`gc.get_referents(object)` function returns a list of all the "
"objects referenced by *object*."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1281
msgid ""
"The :mod:`getopt` module gained a new function, :func:`gnu_getopt`, that "
"supports the same arguments as the existing :func:`getopt` function but uses "
"GNU-style scanning mode. The existing :func:`getopt` stops processing "
"options as soon as a non-option argument is encountered, but in GNU-style "
"mode processing continues, meaning that options and arguments can be mixed. "
"For example::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1292
msgid "(Contributed by Peter Åstrand.)"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1294
msgid ""
"The :mod:`grp`, :mod:`pwd`, and :mod:`resource` modules now return enhanced "
"tuples::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1302
msgid "The :mod:`gzip` module can now handle files exceeding 2 GiB."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1304
msgid ""
"The new :mod:`heapq` module contains an implementation of a heap queue "
"algorithm. A heap is an array-like data structure that keeps items in a "
"partially sorted order such that, for every index *k*, ``heap[k] <= heap[2*k"
"+1]`` and ``heap[k] <= heap[2*k+2]``. This makes it quick to remove the "
"smallest item, and inserting a new item while maintaining the heap property "
"is O(lg n). (See http://www.nist.gov/dads/HTML/priorityque.html for more "
"information about the priority queue data structure.)"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1312
msgid ""
"The :mod:`heapq` module provides :func:`heappush` and :func:`heappop` "
"functions for adding and removing items while maintaining the heap property "
"on top of some other mutable Python sequence type. Here's an example that "
"uses a Python list::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1330
msgid "(Contributed by Kevin O'Connor.)"
msgstr ""
# 2a01baddc34c4e20a502a5f67bb1cce0
#: ../src/Doc/whatsnew/2.3.rst:1332
msgid ""
"The IDLE integrated development environment has been updated using the code "
"from the IDLEfork project (http://idlefork.sourceforge.net). The most "
"notable feature is that the code being developed is now executed in a "
"subprocess, meaning that there's no longer any need for manual ``reload()`` "
"operations. IDLE's core code has been incorporated into the standard library "
"as the :mod:`idlelib` package."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1338
msgid ""
"The :mod:`imaplib` module now supports IMAP over SSL. (Contributed by Piers "
"Lauder and Tino Lange.)"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1341
msgid ""
"The :mod:`itertools` contains a number of useful functions for use with "
"iterators, inspired by various functions provided by the ML and Haskell "
"languages. For example, ``itertools.ifilter(predicate, iterator)`` returns "
"all elements in the iterator for which the function :func:`predicate` "
"returns :const:`True`, and ``itertools.repeat(obj, N)`` returns ``obj`` *N* "
"times. There are a number of other functions in the module; see the "
"package's reference documentation for details. (Contributed by Raymond "
"Hettinger.)"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1350
msgid ""
"Two new functions in the :mod:`math` module, :func:`degrees(rads)` and :func:"
"`radians(degs)`, convert between radians and degrees. Other functions in "
"the :mod:`math` module such as :func:`math.sin` and :func:`math.cos` have "
"always required input values measured in radians. Also, an optional *base* "
"argument was added to :func:`math.log` to make it easier to compute "
"logarithms for bases other than ``e`` and ``10``. (Contributed by Raymond "
"Hettinger.)"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1357
msgid ""
"Several new POSIX functions (:func:`getpgid`, :func:`killpg`, :func:"
"`lchown`, :func:`loadavg`, :func:`major`, :func:`makedev`, :func:`minor`, "
"and :func:`mknod`) were added to the :mod:`posix` module that underlies the :"
"mod:`os` module. (Contributed by Gustavo Niemeyer, Geert Jansen, and Denis "
"S. Otkidach.)"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1363
msgid ""
"In the :mod:`os` module, the :func:`\\*stat` family of functions can now "
"report fractions of a second in a timestamp. Such time stamps are "
"represented as floats, similar to the value returned by :func:`time.time`."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1367
msgid ""
"During testing, it was found that some applications will break if time "
"stamps are floats. For compatibility, when using the tuple interface of "
"the :class:`stat_result` time stamps will be represented as integers. When "
"using named fields (a feature first introduced in Python 2.2), time stamps "
"are still represented as integers, unless :func:`os.stat_float_times` is "
"invoked to enable float return values::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1380
msgid "In Python 2.4, the default will change to always returning floats."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1382
msgid ""
"Application developers should enable this feature only if all their "
"libraries work properly when confronted with floating point time stamps, or "
"if they use the tuple API. If used, the feature should be activated on an "
"application level instead of trying to enable it on a per-use basis."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1387
msgid ""
"The :mod:`optparse` module contains a new parser for command-line arguments "
"that can convert option values to a particular Python type and will "
"automatically generate a usage message. See the following section for more "
"details."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1392
msgid ""
"The old and never-documented :mod:`linuxaudiodev` module has been "
"deprecated, and a new version named :mod:`ossaudiodev` has been added. The "
"module was renamed because the OSS sound drivers can be used on platforms "
"other than Linux, and the interface has also been tidied and brought up to "
"date in various ways. (Contributed by Greg Ward and Nicholas FitzRoy-Dale.)"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1398
msgid ""
"The new :mod:`platform` module contains a number of functions that try to "
"determine various properties of the platform you're running on. There are "
"functions for getting the architecture, CPU type, the Windows OS version, "
"and even the Linux distribution version. (Contributed by Marc-André Lemburg.)"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1403
msgid ""
"The parser objects provided by the :mod:`pyexpat` module can now optionally "
"buffer character data, resulting in fewer calls to your character data "
"handler and therefore faster performance. Setting the parser object's :attr:"
"`buffer_text` attribute to :const:`True` will enable buffering."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1408
msgid ""
"The :func:`sample(population, k)` function was added to the :mod:`random` "
"module. *population* is a sequence or :class:`xrange` object containing the "
"elements of a population, and :func:`sample` chooses *k* elements from the "
"population without replacing chosen elements. *k* can be any value up to "
"``len(population)``. For example::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1430
msgid ""
"The :mod:`random` module now uses a new algorithm, the Mersenne Twister, "
"implemented in C. It's faster and more extensively studied than the "
"previous algorithm."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1434
msgid "(All changes contributed by Raymond Hettinger.)"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1436
msgid ""
"The :mod:`readline` module also gained a number of new functions: :func:"
"`get_history_item`, :func:`get_current_history_length`, and :func:"
"`redisplay`."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1440
msgid ""
"The :mod:`rexec` and :mod:`Bastion` modules have been declared dead, and "
"attempts to import them will fail with a :exc:`RuntimeError`. New-style "
"classes provide new ways to break out of the restricted execution "
"environment provided by :mod:`rexec`, and no one has interest in fixing them "
"or time to do so. If you have applications using :mod:`rexec`, rewrite them "
"to use something else."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1446
msgid ""
"(Sticking with Python 2.2 or 2.1 will not make your applications any safer "
"because there are known bugs in the :mod:`rexec` module in those versions. "
"To repeat: if you're using :mod:`rexec`, stop using it immediately.)"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1450
msgid ""
"The :mod:`rotor` module has been deprecated because the algorithm it uses "
"for encryption is not believed to be secure. If you need encryption, use "
"one of the several AES Python modules that are available separately."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1454
msgid ""
"The :mod:`shutil` module gained a :func:`move(src, dest)` function that "
"recursively moves a file or directory to a new location."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1457
msgid ""
"Support for more advanced POSIX signal handling was added to the :mod:"
"`signal` but then removed again as it proved impossible to make it work "
"reliably across platforms."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1461
msgid ""
"The :mod:`socket` module now supports timeouts. You can call the :meth:"
"`settimeout(t)` method on a socket object to set a timeout of *t* seconds. "
"Subsequent socket operations that take longer than *t* seconds to complete "
"will abort and raise a :exc:`socket.timeout` exception."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1466
msgid ""
"The original timeout implementation was by Tim O'Malley. Michael Gilfix "
"integrated it into the Python :mod:`socket` module and shepherded it through "
"a lengthy review. After the code was checked in, Guido van Rossum rewrote "
"parts of it. (This is a good example of a collaborative development process "
"in action.)"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1472
msgid ""
"On Windows, the :mod:`socket` module now ships with Secure Sockets Layer "
"(SSL) support."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1475
msgid ""
"The value of the C :const:`PYTHON_API_VERSION` macro is now exposed at the "
"Python level as ``sys.api_version``. The current exception can be cleared "
"by calling the new :func:`sys.exc_clear` function."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1479
msgid ""
"The new :mod:`tarfile` module allows reading from and writing to :program:"
"`tar`\\ -format archive files. (Contributed by Lars Gustäbel.)"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1482
msgid ""
"The new :mod:`textwrap` module contains functions for wrapping strings "
"containing paragraphs of text. The :func:`wrap(text, width)` function takes "
"a string and returns a list containing the text split into lines of no more "
"than the chosen width. The :func:`fill(text, width)` function returns a "
"single string, reformatted to fit into lines no longer than the chosen "
"width. (As you can guess, :func:`fill` is built on top of :func:`wrap`. For "
"example::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1504
msgid ""
"The module also contains a :class:`TextWrapper` class that actually "
"implements the text wrapping strategy. Both the :class:`TextWrapper` class "
"and the :func:`wrap` and :func:`fill` functions support a number of "
"additional keyword arguments for fine-tuning the formatting; consult the "
"module's documentation for details. (Contributed by Greg Ward.)"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1510
msgid ""
"The :mod:`thread` and :mod:`threading` modules now have companion modules, :"
"mod:`dummy_thread` and :mod:`dummy_threading`, that provide a do-nothing "
"implementation of the :mod:`thread` module's interface for platforms where "
"threads are not supported. The intention is to simplify thread-aware "
"modules (ones that *don't* rely on threads to run) by putting the following "
"code at the top::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1522
msgid ""
"In this example, :mod:`_threading` is used as the module name to make it "
"clear that the module being used is not necessarily the actual :mod:"
"`threading` module. Code can call functions and use classes in :mod:"
"`_threading` whether or not threads are supported, avoiding an :keyword:`if` "
"statement and making the code slightly clearer. This module will not "
"magically make multithreaded code run without threads; code that waits for "
"another thread to return or to do something will simply hang forever."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1530
msgid ""
"The :mod:`time` module's :func:`strptime` function has long been an "
"annoyance because it uses the platform C library's :func:`strptime` "
"implementation, and different platforms sometimes have odd bugs. Brett "
"Cannon contributed a portable implementation that's written in pure Python "
"and should behave identically on all platforms."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1536
msgid ""
"The new :mod:`timeit` module helps measure how long snippets of Python code "
"take to execute. The :file:`timeit.py` file can be run directly from the "
"command line, or the module's :class:`Timer` class can be imported and used "
"directly. Here's a short example that figures out whether it's faster to "
"convert an 8-bit string to Unicode by appending an empty Unicode string to "
"it or by using the :func:`unicode` function::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1556
msgid ""
"The :mod:`Tix` module has received various bug fixes and updates for the "
"current version of the Tix package."
msgstr ""
# e796ed197479444a834a668530a4c907
#: ../src/Doc/whatsnew/2.3.rst:1559
msgid ""
"The :mod:`Tkinter` module now works with a thread-enabled version of Tcl. "
"Tcl's threading model requires that widgets only be accessed from the thread "
"in which they're created; accesses from another thread can cause Tcl to "
"panic. For certain Tcl interfaces, :mod:`Tkinter` will now automatically "
"avoid this when a widget is accessed from a different thread by marshalling "
"a command, passing it to the correct thread, and waiting for the results. "
"Other interfaces can't be handled automatically but :mod:`Tkinter` will now "
"raise an exception on such an access so that you can at least find out about "
"the problem. See https://mail.python.org/pipermail/python-dev/2002-"
"December/031107.html for a more detailed explanation of this change. "
"(Implemented by Martin von Löwis.)"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1570
msgid ""
"Calling Tcl methods through :mod:`_tkinter` no longer returns only strings. "
"Instead, if Tcl returns other objects those objects are converted to their "
"Python equivalent, if one exists, or wrapped with a :class:`_tkinter."
"Tcl_Obj` object if no Python equivalent exists. This behavior can be "
"controlled through the :meth:`wantobjects` method of :class:`tkapp` objects."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1576
msgid ""
"When using :mod:`_tkinter` through the :mod:`Tkinter` module (as most "
"Tkinter applications will), this feature is always activated. It should not "
"cause compatibility problems, since Tkinter would always convert string "
"results to Python types where possible."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1581
msgid ""
"If any incompatibilities are found, the old behavior can be restored by "
"setting the :attr:`wantobjects` variable in the :mod:`Tkinter` module to "
"false before creating the first :class:`tkapp` object. ::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1588
msgid "Any breakage caused by this change should be reported as a bug."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1590
msgid ""
"The :mod:`UserDict` module has a new :class:`DictMixin` class which defines "
"all dictionary methods for classes that already have a minimum mapping "
"interface. This greatly simplifies writing classes that need to be "
"substitutable for dictionaries, such as the classes in the :mod:`shelve` "
"module."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1596
msgid ""
"Adding the mix-in as a superclass provides the full dictionary interface "
"whenever the class defines :meth:`__getitem__`, :meth:`__setitem__`, :meth:"
"`__delitem__`, and :meth:`keys`. For example::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1637 ../src/Doc/whatsnew/2.4.rst:891
#: ../src/Doc/whatsnew/2.4.rst:919 ../src/Doc/whatsnew/2.4.rst:1212
#: ../src/Doc/whatsnew/2.5.rst:1372 ../src/Doc/whatsnew/2.5.rst:1381
#: ../src/Doc/whatsnew/2.6.rst:1592 ../src/Doc/whatsnew/2.6.rst:1876
#: ../src/Doc/whatsnew/2.6.rst:1897
msgid "(Contributed by Raymond Hettinger.)"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1639
msgid ""
"The DOM implementation in :mod:`xml.dom.minidom` can now generate XML output "
"in a particular encoding by providing an optional encoding argument to the :"
"meth:`toxml` and :meth:`toprettyxml` methods of DOM nodes."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1643
msgid ""
"The :mod:`xmlrpclib` module now supports an XML-RPC extension for handling "
"nil data values such as Python's ``None``. Nil values are always supported "
"on unmarshalling an XML-RPC response. To generate requests containing "
"``None``, you must supply a true value for the *allow_none* parameter when "
"creating a :class:`Marshaller` instance."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1649
msgid ""
"The new :mod:`DocXMLRPCServer` module allows writing self-documenting XML-"
"RPC servers. Run it in demo mode (as a program) to see it in action. "
"Pointing the Web browser to the RPC server produces pydoc-style "
"documentation; pointing xmlrpclib to the server allows invoking the actual "
"methods. (Contributed by Brian Quinlan.)"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1655
msgid ""
"Support for internationalized domain names (RFCs 3454, 3490, 3491, and 3492) "
"has been added. The \"idna\" encoding can be used to convert between a "
"Unicode domain name and the ASCII-compatible encoding (ACE) of that name. ::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1662
msgid ""
"The :mod:`socket` module has also been extended to transparently convert "
"Unicode hostnames to the ACE version before passing them to the C library. "
"Modules that deal with hostnames such as :mod:`httplib` and :mod:`ftplib`) "
"also support Unicode host names; :mod:`httplib` also sends HTTP ``Host`` "
"headers using the ACE version of the domain name. :mod:`urllib` supports "
"Unicode URLs with non-ASCII host names as long as the ``path`` part of the "
"URL is ASCII only."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1670
msgid ""
"To implement this change, the :mod:`stringprep` module, the "
"``mkstringprep`` tool and the ``punycode`` encoding have been added."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1677
msgid "Date/Time Type"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1679
msgid ""
"Date and time types suitable for expressing timestamps were added as the :"
"mod:`datetime` module. The types don't support different calendars or many "
"fancy features, and just stick to the basics of representing time."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1683
msgid ""
"The three primary types are: :class:`date`, representing a day, month, and "
"year; :class:`time`, consisting of hour, minute, and second; and :class:"
"`datetime`, which contains all the attributes of both :class:`date` and :"
"class:`time`. There's also a :class:`timedelta` class representing "
"differences between two points in time, and time zone logic is implemented "
"by classes inheriting from the abstract :class:`tzinfo` class."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1690
msgid ""
"You can create instances of :class:`date` and :class:`time` by either "
"supplying keyword arguments to the appropriate constructor, e.g. ``datetime."
"date(year=1972, month=10, day=15)``, or by using one of a number of class "
"methods. For example, the :meth:`date.today` class method returns the "
"current local date."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1696
msgid ""
"Once created, instances of the date/time classes are all immutable. There "
"are a number of methods for producing formatted strings from objects::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1708
msgid ""
"The :meth:`replace` method allows modifying one or more fields of a :class:"
"`date` or :class:`datetime` instance, returning a new instance::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1718
msgid ""
"Instances can be compared, hashed, and converted to strings (the result is "
"the same as that of :meth:`isoformat`). :class:`date` and :class:`datetime` "
"instances can be subtracted from each other, and added to :class:`timedelta` "
"instances. The largest missing feature is that there's no standard library "
"support for parsing strings and getting back a :class:`date` or :class:"
"`datetime`."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1725
msgid ""
"For more information, refer to the module's reference documentation. "
"(Contributed by Tim Peters.)"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1732
msgid "The optparse Module"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1734
msgid ""
"The :mod:`getopt` module provides simple parsing of command-line arguments. "
"The new :mod:`optparse` module (originally named Optik) provides more "
"elaborate command-line parsing that follows the Unix conventions, "
"automatically creates the output for :option:`--help`, and can perform "
"different actions for different options."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1740
msgid ""
"You start by creating an instance of :class:`OptionParser` and telling it "
"what your program's options are. ::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1754
msgid ""
"Parsing a command line is then done by calling the :meth:`parse_args` "
"method. ::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1760
msgid ""
"This returns an object containing all of the option values, and a list of "
"strings containing the remaining arguments."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1763
msgid ""
"Invoking the script with the various arguments now works as you'd expect it "
"to. Note that the length argument is automatically converted to an "
"integer. ::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1774
msgid "The help message is automatically generated for you::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1787
msgid "See the module's documentation for more details."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1790
msgid ""
"Optik was written by Greg Ward, with suggestions from the readers of the "
"Getopt SIG."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1799
msgid "Pymalloc: A Specialized Object Allocator"
msgstr ""
# 7d99a991aa4e47009bacde9e7ab51520
#: ../src/Doc/whatsnew/2.3.rst:1801
msgid ""
"Pymalloc, a specialized object allocator written by Vladimir Marangozov, was "
"a feature added to Python 2.1. Pymalloc is intended to be faster than the "
"system :c:func:`malloc` and to have less memory overhead for allocation "
"patterns typical of Python programs. The allocator uses C's :c:func:`malloc` "
"function to get large pools of memory and then fulfills smaller memory "
"requests from these pools."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1807
msgid ""
"In 2.1 and 2.2, pymalloc was an experimental feature and wasn't enabled by "
"default; you had to explicitly enable it when compiling Python by providing "
"the :option:`--with-pymalloc` option to the :program:`configure` script. In "
"2.3, pymalloc has had further enhancements and is now enabled by default; "
"you'll have to supply :option:`--without-pymalloc` to disable it."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1813
msgid ""
"This change is transparent to code written in Python; however, pymalloc may "
"expose bugs in C extensions. Authors of C extension modules should test "
"their code with pymalloc enabled, because some incorrect code may cause core "
"dumps at runtime."
msgstr ""
# 4f64634a72ae4c45b05a19ad8dbb1f9b
#: ../src/Doc/whatsnew/2.3.rst:1818
msgid ""
"There's one particularly common error that causes problems. There are a "
"number of memory allocation functions in Python's C API that have previously "
"just been aliases for the C library's :c:func:`malloc` and :c:func:`free`, "
"meaning that if you accidentally called mismatched functions the error "
"wouldn't be noticeable. When the object allocator is enabled, these "
"functions aren't aliases of :c:func:`malloc` and :c:func:`free` any more, "
"and calling the wrong function to free memory may get you a core dump. For "
"example, if memory was allocated using :c:func:`PyObject_Malloc`, it has to "
"be freed using :c:func:`PyObject_Free`, not :c:func:`free`. A few modules "
"included with Python fell afoul of this and had to be fixed; doubtless there "
"are more third-party modules that will have the same problem."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1830
msgid ""
"As part of this change, the confusing multiple interfaces for allocating "
"memory have been consolidated down into two API families. Memory allocated "
"with one family must not be manipulated with functions from the other "
"family. There is one family for allocating chunks of memory and another "
"family of functions specifically for allocating Python objects."
msgstr ""
# b5946ae9d768455f91fa76a1871ade1c
#: ../src/Doc/whatsnew/2.3.rst:1836
msgid ""
"To allocate and free an undistinguished chunk of memory use the \"raw memory"
"\" family: :c:func:`PyMem_Malloc`, :c:func:`PyMem_Realloc`, and :c:func:"
"`PyMem_Free`."
msgstr ""
# e1af3f7b04ca46b2933b84aa61f9ee00
#: ../src/Doc/whatsnew/2.3.rst:1839
msgid ""
"The \"object memory\" family is the interface to the pymalloc facility "
"described above and is biased towards a large number of \"small\" "
"allocations: :c:func:`PyObject_Malloc`, :c:func:`PyObject_Realloc`, and :c:"
"func:`PyObject_Free`."
msgstr ""
# e70b33e0ca2f452ca85a2017b9ae972c
#: ../src/Doc/whatsnew/2.3.rst:1843
msgid ""
"To allocate and free Python objects, use the \"object\" family :c:func:"
"`PyObject_New`, :c:func:`PyObject_NewVar`, and :c:func:`PyObject_Del`."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1846
msgid ""
"Thanks to lots of work by Tim Peters, pymalloc in 2.3 also provides "
"debugging features to catch memory overwrites and doubled frees in both "
"extension modules and in the interpreter itself. To enable this support, "
"compile a debugging version of the Python interpreter by running :program:"
"`configure` with :option:`--with-pydebug`."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1852
msgid ""
"To aid extension writers, a header file :file:`Misc/pymemcompat.h` is "
"distributed with the source to Python 2.3 that allows Python extensions to "
"use the 2.3 interfaces to memory allocation while compiling against any "
"version of Python since 1.5.2. You would copy the file from Python's source "
"distribution and bundle it with the source of your extension."
msgstr ""
# b82b80b147a145d4bb3e9a6eb7eee76c
#: ../src/Doc/whatsnew/2.3.rst:1862
msgid "https://svn.python.org/view/python/trunk/Objects/obmalloc.c"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1862
msgid ""
"For the full details of the pymalloc implementation, see the comments at the "
"top of the file :file:`Objects/obmalloc.c` in the Python source code. The "
"above link points to the file within the python.org SVN browser."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1870 ../src/Doc/whatsnew/2.4.rst:1446
#: ../src/Doc/whatsnew/2.5.rst:2079 ../src/Doc/whatsnew/2.6.rst:2975
#: ../src/Doc/whatsnew/2.7.rst:2076
msgid "Build and C API Changes"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1872 ../src/Doc/whatsnew/2.5.rst:2081
#: ../src/Doc/whatsnew/2.6.rst:2977 ../src/Doc/whatsnew/2.7.rst:2078
msgid "Changes to Python's build process and to the C API include:"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1874
msgid ""
"The cycle detection implementation used by the garbage collection has proven "
"to be stable, so it's now been made mandatory. You can no longer compile "
"Python without it, and the :option:`--with-cycle-gc` switch to :program:"
"`configure` has been removed."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1879
msgid ""
"Python can now optionally be built as a shared library (:file:`libpython2.3."
"so`) by supplying :option:`--enable-shared` when running Python's :program:"
"`configure` script. (Contributed by Ondrej Palkovsky.)"
msgstr ""
# f3929df21488456fb73c115da52d272a
#: ../src/Doc/whatsnew/2.3.rst:1883
msgid ""
"The :c:macro:`DL_EXPORT` and :c:macro:`DL_IMPORT` macros are now deprecated. "
"Initialization functions for Python extension modules should now be declared "
"using the new macro :c:macro:`PyMODINIT_FUNC`, while the Python core will "
"generally use the :c:macro:`PyAPI_FUNC` and :c:macro:`PyAPI_DATA` macros."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1888
msgid ""
"The interpreter can be compiled without any docstrings for the built-in "
"functions and modules by supplying :option:`--without-doc-strings` to the :"
"program:`configure` script. This makes the Python executable about 10% "
"smaller, but will also mean that you can't get help for Python's built-ins. "
"(Contributed by Gustavo Niemeyer.)"
msgstr ""
# f3fa68dce59440aca87a07e65bb78d38
#: ../src/Doc/whatsnew/2.3.rst:1894
msgid ""
"The :c:func:`PyArg_NoArgs` macro is now deprecated, and code that uses it "
"should be changed. For Python 2.2 and later, the method definition table "
"can specify the :const:`METH_NOARGS` flag, signalling that there are no "
"arguments, and the argument checking can then be removed. If compatibility "
"with pre-2.2 versions of Python is important, the code could use "
"``PyArg_ParseTuple(args, \"\")`` instead, but this will be slower than "
"using :const:`METH_NOARGS`."
msgstr ""
# 396f9ba7c2694dec9fab3ff0c42425df
#: ../src/Doc/whatsnew/2.3.rst:1901
msgid ""
":c:func:`PyArg_ParseTuple` accepts new format characters for various sizes "
"of unsigned integers: ``B`` for :c:type:`unsigned char`, ``H`` for :c:type:"
"`unsigned short int`, ``I`` for :c:type:`unsigned int`, and ``K`` for :c:"
"type:`unsigned long long`."
msgstr ""
# b600648f9bdc4af6941215378c6be113
#: ../src/Doc/whatsnew/2.3.rst:1906
msgid ""
"A new function, :c:func:`PyObject_DelItemString(mapping, char \\*key)` was "
"added as shorthand for ``PyObject_DelItem(mapping, PyString_New(key))``."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1909
msgid ""
"File objects now manage their internal string buffer differently, increasing "
"it exponentially when needed. This results in the benchmark tests in :file:"
"`Lib/test/test_bufio.py` speeding up considerably (from 57 seconds to 1.7 "
"seconds, according to one measurement)."
msgstr ""
# 2c50550c666f40899a93278d01910405
#: ../src/Doc/whatsnew/2.3.rst:1914
msgid ""
"It's now possible to define class and static methods for a C extension type "
"by setting either the :const:`METH_CLASS` or :const:`METH_STATIC` flags in a "
"method's :c:type:`PyMethodDef` structure."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1918
msgid ""
"Python now includes a copy of the Expat XML parser's source code, removing "
"any dependence on a system version or local installation of Expat."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1921
msgid ""
"If you dynamically allocate type objects in your extension, you should be "
"aware of a change in the rules relating to the :attr:`__module__` and :attr:"
"`__name__` attributes. In summary, you will want to ensure the type's "
"dictionary contains a ``'__module__'`` key; making the module name the part "
"of the type name leading up to the final period will no longer have the "
"desired effect. For more detail, read the API reference documentation or "
"the source."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1932 ../src/Doc/whatsnew/2.4.rst:1499
#: ../src/Doc/whatsnew/2.5.rst:2207
msgid "Port-Specific Changes"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1934
msgid ""
"Support for a port to IBM's OS/2 using the EMX runtime environment was "
"merged into the main Python source tree. EMX is a POSIX emulation layer "
"over the OS/2 system APIs. The Python port for EMX tries to support all the "
"POSIX-like capability exposed by the EMX runtime, and mostly succeeds; :func:"
"`fork` and :func:`fcntl` are restricted by the limitations of the underlying "
"emulation layer. The standard OS/2 port, which uses IBM's Visual Age "
"compiler, also gained support for case-sensitive import semantics as part of "
"the integration of the EMX port into CVS. (Contributed by Andrew MacIntyre.)"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1943
msgid ""
"On MacOS, most toolbox modules have been weaklinked to improve backward "
"compatibility. This means that modules will no longer fail to load if a "
"single routine is missing on the current OS version. Instead calling the "
"missing routine will raise an exception. (Contributed by Jack Jansen.)"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1948
msgid ""
"The RPM spec files, found in the :file:`Misc/RPM/` directory in the Python "
"source distribution, were updated for 2.3. (Contributed by Sean "
"Reifschneider.)"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1951
msgid ""
"Other new platforms now supported by Python include AtheOS (http://www."
"atheos.cx/), GNU/Hurd, and OpenVMS."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1962
msgid ""
"As usual, there were a bunch of other improvements and bugfixes scattered "
"throughout the source tree. A search through the CVS change logs finds "
"there were 523 patches applied and 514 bugs fixed between Python 2.2 and "
"2.3. Both figures are likely to be underestimates."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1969
msgid ""
"If the :envvar:`PYTHONINSPECT` environment variable is set, the Python "
"interpreter will enter the interactive prompt after running a Python "
"program, as if Python had been invoked with the :option:`-i` option. The "
"environment variable can be set before running the Python interpreter, or it "
"can be set by the Python program as part of its execution."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1975
msgid ""
"The :file:`regrtest.py` script now provides a way to allow \"all resources "
"except *foo*.\" A resource name passed to the :option:`-u` option can now "
"be prefixed with a hyphen (``'-'``) to mean \"remove this resource.\" For "
"example, the option '``-uall,-bsddb``' could be used to enable the use of "
"all resources except ``bsddb``."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1981
msgid ""
"The tools used to build the documentation now work under Cygwin as well as "
"Unix."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1984
msgid ""
"The ``SET_LINENO`` opcode has been removed. Back in the mists of time, this "
"opcode was needed to produce line numbers in tracebacks and support trace "
"functions (for, e.g., :mod:`pdb`). Since Python 1.5, the line numbers in "
"tracebacks have been computed using a different mechanism that works with "
"\"python -O\". For Python 2.3 Michael Hudson implemented a similar scheme "
"to determine when to call the trace function, removing the need for "
"``SET_LINENO`` entirely."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1992
msgid ""
"It would be difficult to detect any resulting difference from Python code, "
"apart from a slight speed up when Python is run without :option:`-O`."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:1995
msgid ""
"C extensions that access the :attr:`f_lineno` field of frame objects should "
"instead call ``PyCode_Addr2Line(f->f_code, f->f_lasti)``. This will have the "
"added effect of making the code work as desired under \"python -O\" in "
"earlier versions of Python."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:2000
msgid ""
"A nifty new feature is that trace functions can now assign to the :attr:"
"`f_lineno` attribute of frame objects, changing the line that will be "
"executed next. A ``jump`` command has been added to the :mod:`pdb` debugger "
"taking advantage of this new feature. (Implemented by Richie Hindle.)"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:2009
msgid "Porting to Python 2.3"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:2011 ../src/Doc/whatsnew/2.4.rst:1510
#: ../src/Doc/whatsnew/2.5.rst:2229
msgid ""
"This section lists previously described changes that may require changes to "
"your code:"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:2014
msgid ""
":keyword:`yield` is now always a keyword; if it's used as a variable name in "
"your code, a different name must be chosen."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:2017
msgid ""
"For strings *X* and *Y*, ``X in Y`` now works if *X* is more than one "
"character long."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:2020
msgid ""
"The :func:`int` type constructor will now return a long integer instead of "
"raising an :exc:`OverflowError` when a string or floating-point number is "
"too large to fit into an integer."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:2024
msgid ""
"If you have Unicode strings that contain 8-bit characters, you must declare "
"the file's encoding (UTF-8, Latin-1, or whatever) by adding a comment to the "
"top of the file. See section :ref:`section-encodings` for more information."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:2028
msgid ""
"Calling Tcl methods through :mod:`_tkinter` no longer returns only strings. "
"Instead, if Tcl returns other objects those objects are converted to their "
"Python equivalent, if one exists, or wrapped with a :class:`_tkinter."
"Tcl_Obj` object if no Python equivalent exists."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:2033
msgid ""
"Large octal and hex literals such as ``0xffffffff`` now trigger a :exc:"
"`FutureWarning`. Currently they're stored as 32-bit numbers and result in a "
"negative value, but in Python 2.4 they'll become positive long integers."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:2037
msgid ""
"There are a few ways to fix this warning. If you really need a positive "
"number, just add an ``L`` to the end of the literal. If you're trying to "
"get a 32-bit integer with low bits set and have previously used an "
"expression such as ``~(1 << 31)``, it's probably clearest to start with all "
"bits set and clear the desired upper bits. For example, to clear just the "
"top bit (bit 31), you could write ``0xffffffffL &~(1L<<31)``."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:2044
msgid "You can no longer disable assertions by assigning to ``__debug__``."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:2046
msgid ""
"The Distutils :func:`setup` function has gained various new keyword "
"arguments such as *depends*. Old versions of the Distutils will abort if "
"passed unknown keywords. A solution is to check for the presence of the "
"new :func:`get_distutil_options` function in your :file:`setup.py` and only "
"uses the new keywords with a version of the Distutils that supports them::"
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:2059
msgid ""
"Using ``None`` as a variable name will now result in a :exc:`SyntaxWarning` "
"warning."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:2062
msgid ""
"Names of extension types defined by the modules included with Python now "
"contain the module and a ``'.'`` in front of the type name."
msgstr ""
#: ../src/Doc/whatsnew/2.3.rst:2073
msgid ""
"The author would like to thank the following people for offering "
"suggestions, corrections and assistance with various drafts of this article: "
"Jeff Bauer, Simon Brunning, Brett Cannon, Michael Chermside, Andrew Dalke, "
"Scott David Daniels, Fred L. Drake, Jr., David Fraser, Kelly Gerber, "
"Raymond Hettinger, Michael Hudson, Chris Lambert, Detlef Lannert, Martin von "
"Löwis, Andrew MacIntyre, Lalo Martins, Chad Netzer, Gustavo Niemeyer, Neal "
"Norwitz, Hans Nowak, Chris Reedy, Francesco Ricciardi, Vinay Sajip, Neil "
"Schemenauer, Roman Suzi, Jason Tishler, Just van Rossum."
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:3
msgid "What's New in Python 2.4"
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:14
msgid ""
"This article explains the new features in Python 2.4.1, released on March "
"30, 2005."
msgstr ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/Doc/whatsnew/2.4.rst:36
msgid "PEP 218: Built-In Set Objects"
msgstr ""
#: ../src/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, :"
"func:`set(iterable)` and :func:`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 ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/Doc/whatsnew/2.4.rst:83
msgid ""
"Originally proposed by Greg Wilson and ultimately implemented by Raymond "
"Hettinger."
msgstr ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/Doc/whatsnew/2.4.rst:115
msgid "PEP 289: Generator Expressions"
msgstr ""
#: ../src/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 ""
#: ../src/Doc/whatsnew/2.4.rst:129
msgid "instead of ::"
msgstr ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
# ae39302fad754779bdbd30cbf558f66d
#: ../src/Doc/whatsnew/2.4.rst:164
msgid ":pep:`289` - Generator Expressions"
msgstr ""
#: ../src/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 ""
#: ../src/Doc/whatsnew/2.4.rst:172
msgid "PEP 292: Simpler String Substitutions"
msgstr ""
#: ../src/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 ""
#: ../src/Doc/whatsnew/2.4.rst:178
msgid "The usual way of substituting variables by name is the ``%`` operator::"
msgstr ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
# ab9e463b5d424e519905eb5d84560906
#: ../src/Doc/whatsnew/2.4.rst:210
msgid ":pep:`292` - Simpler String Substitutions"
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:212
msgid "Written and implemented by Barry Warsaw."
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:218
msgid "PEP 318: Decorators for Functions and Methods"
msgstr ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/Doc/whatsnew/2.4.rst:265
msgid "It's equivalent to the following pre-decorator code::"
msgstr ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/Doc/whatsnew/2.4.rst:325
msgid ""
"Getting this right can be slightly brain-bending, but it's not too difficult."
msgstr ""
#: ../src/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 ""
# 2c51a80040a941579e0355fb8becc327
#: ../src/Doc/whatsnew/2.4.rst:337
msgid ":pep:`318` - Decorators for Functions, Methods and Classes"
msgstr ""
#: ../src/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 ""
# e8f01f28d2db4e48ae8d613d93ade250
#: ../src/Doc/whatsnew/2.4.rst:339
msgid "https://www.python.org/moin/PythonDecoratorLibrary"
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:341
msgid "This Wiki page contains several examples of decorators."
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:347
msgid "PEP 322: Reverse Iteration"
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:349
msgid ""
"A new built-in function, :func:`reversed(seq)`, takes a sequence and returns "
"an iterator that loops over the elements of the sequence in reverse "
"order. ::"
msgstr ""
#: ../src/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 ""
#: ../src/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 ""
# 4025443dbc81438d8b03171fd3cf7890
#: ../src/Doc/whatsnew/2.4.rst:375
msgid ":pep:`322` - Reverse Iteration"
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:377
msgid "Written and implemented by Raymond Hettinger."
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:383
msgid "PEP 324: New subprocess Module"
msgstr ""
#: ../src/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. :func:`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 ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/Doc/whatsnew/2.4.rst:417
msgid "The constructor has a number of handy options:"
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:419
msgid ""
"*close_fds* requests that all file descriptors be closed before running the "
"subprocess."
msgstr ""
#: ../src/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 ""
#: ../src/Doc/whatsnew/2.4.rst:425
msgid "*env* is a dictionary specifying environment variables."
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:427
msgid ""
"*preexec_fn* is a function that gets called before the child is started."
msgstr ""
# 459672945e8e4e059eb082756d8171a4
#: ../src/Doc/whatsnew/2.4.rst:429
msgid ""
"*universal_newlines* opens the child's input and output using Python's :term:"
"`universal newlines` feature."
msgstr ""
#: ../src/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 :meth:`communicate(data)` to send "
"the string *data* to the subprocess's standard input. :meth:"
"`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 ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
# 8fad50f2c1a54a05b762fc849151b13f
#: ../src/Doc/whatsnew/2.4.rst:464
msgid ":pep:`324` - subprocess - New process module"
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:465
msgid ""
"Written and implemented by Peter Åstrand, with assistance from Fredrik Lundh "
"and others."
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:472
msgid "PEP 327: Decimal Data Type"
msgstr ""
# d2c30993d59c4cc6b854b94d665b7dc7
#: ../src/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 ""
#: ../src/Doc/whatsnew/2.4.rst:483
msgid "Why is Decimal needed?"
msgstr ""
#: ../src/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 ""
#: ../src/Doc/whatsnew/2.4.rst:488
msgid "The sign, which is positive or negative."
msgstr ""
#: ../src/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 ""
#: ../src/Doc/whatsnew/2.4.rst:494
msgid ""
"The exponent, which tells where the decimal point is located in the number "
"represented."
msgstr ""
#: ../src/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 ""
# 05d6091fe53448f79a8be60eb9dcadb0
#: ../src/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 ""
#: ../src/Doc/whatsnew/2.4.rst:515
msgid "Sometimes you can see this inaccuracy when the number is printed::"
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:520
msgid ""
"The inaccuracy isn't always visible when you print the number because the FP-"
"to- decimal-string conversion is provided by the C library, and most C "
"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 ""
#: ../src/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 ""
#: ../src/Doc/whatsnew/2.4.rst:533
msgid "Hence, the :class:`Decimal` type was created."
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:537
msgid "The :class:`Decimal` type"
msgstr ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/Doc/whatsnew/2.4.rst:598
msgid ""
"You can combine :class:`Decimal` instances with integers, but not with "
"floating- point numbers::"
msgstr ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/Doc/whatsnew/2.4.rst:631
msgid "The :class:`Context` type"
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:633
msgid ""
"Instances of the :class:`Context` class encapsulate several settings for "
"decimal operations:"
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:636
msgid ":attr:`prec` is the precision, the number of decimal places."
msgstr ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
# 299e5b71e1ca43eb89bba06fb1fe72f2
#: ../src/Doc/whatsnew/2.4.rst:683
msgid ":pep:`327` - Decimal Data Type"
msgstr ""
#: ../src/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 ""
# 733c07fc0c224231abc5d275cee01005
#: ../src/Doc/whatsnew/2.4.rst:687
msgid "http://www.lahey.com/float.htm"
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:687
msgid ""
"The article uses Fortran code to illustrate many of the problems that "
"floating- point inaccuracy can cause."
msgstr ""
# 7d5e0dd8593f47d195990ecfcd653941
#: ../src/Doc/whatsnew/2.4.rst:691
msgid "http://www2.hursley.ibm.com/decimal/"
msgstr ""
#: ../src/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 ""
#: ../src/Doc/whatsnew/2.4.rst:699
msgid "PEP 328: Multi-line Imports"
msgstr ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
# 8ae0c81ef6a14a4a8ec0613142da5276
# d0822458723f4803bc5eedd5826af4e7
#: ../src/Doc/whatsnew/2.4.rst:727 ../src/Doc/whatsnew/2.5.rst:330
msgid ":pep:`328` - Imports: Multi-Line and Absolute/Relative"
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:729
msgid "Written by Aahz. Multi-line imports were implemented by Dima Dorfman."
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:735
msgid "PEP 331: Locale-Independent Float/String Conversions"
msgstr ""
# 85a83f3f26c9478bbfa7ed28c42aef20
#: ../src/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 ""
#: ../src/Doc/whatsnew/2.4.rst:744
msgid ""
"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."
msgstr ""
#: ../src/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 ""
# 13083cd0740e4b6bbec54b46ce67209b
#: ../src/Doc/whatsnew/2.4.rst:752
msgid ""
":c:func:`PyOS_ascii_strtod(str, ptr)` and :c:func:`PyOS_ascii_atof(str, "
"ptr)` both convert a string to a C :c:type:`double`."
msgstr ""
# 871980f609ad4f70b4db062dd34a7a55
#: ../src/Doc/whatsnew/2.4.rst:755
msgid ""
":c:func:`PyOS_ascii_formatd(buffer, buf_len, format, d)` converts a :c:type:"
"`double` to an ASCII string."
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:758
msgid ""
"The code for these functions came from the GLib library (http://library."
"gnome.org/devel/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 ""
# 2cd9f7b3734f479692f864d11fa6d2a0
#: ../src/Doc/whatsnew/2.4.rst:766
msgid ":pep:`331` - Locale-Independent Float/String Conversions"
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:768
msgid "Written by Christian R. Reis, and implemented by Gustavo Carneiro."
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:776
msgid ""
"Here are all of the changes that Python 2.4 makes to the core Python "
"language."
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:778
msgid "Decorators for functions and methods were added (:pep:`318`)."
msgstr ""
#: ../src/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 :func:`reversed(seq)` function (:pep:`322`)."
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:783
msgid "Generator expressions were added (:pep:`289`)."
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:785
msgid ""
"Certain numeric expressions no longer return values restricted to 32 or 64 "
"bits (:pep:`237`)."
msgstr ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
# bec815d9eb0c4495ad414f09eb42fa3e
#: ../src/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 ""
#: ../src/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 ""
#: ../src/Doc/whatsnew/2.4.rst:858
msgid "(All changes to :meth:`sort` contributed by Raymond Hettinger.)"
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:860
msgid ""
"There is a new built-in function :func:`sorted(iterable)` that works like "
"the in-place :meth:`list.sort` method but can be used in expressions. The "
"differences are:"
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:864
msgid "the input may be any iterable;"
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:866
msgid "a newly formed copy is sorted, leaving the original intact; and"
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:868
msgid "the expression returns the new sorted copy"
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:893 ../src/Doc/whatsnew/2.4.rst:1517
msgid ""
"Integer operations will no longer trigger an :exc:`OverflowWarning`. The :"
"exc:`OverflowWarning` warning will disappear in Python 2.5."
msgstr ""
#: ../src/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 ""
#: ../src/Doc/whatsnew/2.4.rst:901
msgid ""
"The :func:`eval(expr, globals, locals)` and :func:`execfile(filename, "
"globals, locals)` functions and the :keyword:`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 ""
#: ../src/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 ""
#: ../src/Doc/whatsnew/2.4.rst:921
msgid ""
"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.)"
msgstr ""
#: ../src/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 ""
#: ../src/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 ""
# 25d6374f33f542f6bae0bad3730f28d7
#: ../src/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 ""
#: ../src/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 ""
# f4ce73505c3948bca638dc0268199532
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/Doc/whatsnew/2.4.rst:1001
msgid ""
"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.)"
msgstr ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/Doc/whatsnew/2.4.rst:1011
msgid "Chinese (PRC): gb2312, gbk, gb18030, big5hkscs, hz"
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:1013
msgid "Chinese (ROC): big5, cp950"
msgstr ""
# db893a32a5cc4293b9895cb29526ecaa
#: ../src/Doc/whatsnew/2.4.rst:1016
msgid "Japanese: cp932, euc-jis-2004, euc-jp, euc-jisx0213, iso-2022-jp,"
msgstr ""
#: ../src/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 ""
#: ../src/Doc/whatsnew/2.4.rst:1019
msgid "Korean: cp949, euc-kr, johab, iso-2022-kr"
msgstr ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/Doc/whatsnew/2.4.rst:1030
msgid ""
"There is a new :mod:`collections` module for various specialized collection "
"datatypes. Currently it contains just one type, :class:`deque`, a double- "
"ended queue that supports efficiently adding and removing elements from "
"either end::"
msgstr ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
# df9192468fc846f49666919701218ded
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/Doc/whatsnew/2.4.rst:1093
msgid ""
"The :mod:`itertools` module gained a :func:`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 ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/Doc/whatsnew/2.4.rst:1140
msgid "(Contributed by Hye-Shik Chang.)"
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:1142
msgid ""
":mod:`itertools` also gained a function named :func:`tee(iterator, N)` that "
"returns *N* independent iterators that replicate *iterator*. If *N* is "
"omitted, the default is 2. ::"
msgstr ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/Doc/whatsnew/2.4.rst:1180
msgid ""
"Other additions to the :mod:`logging` package include a :meth:`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 ""
#: ../src/Doc/whatsnew/2.4.rst:1187
msgid "(Changes implemented by Vinay Sajip.)"
msgstr ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/Doc/whatsnew/2.4.rst:1198
msgid ""
"Two new functions were added to the :mod:`operator` module, :func:"
"`attrgetter(attr)` and :func:`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 ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/Doc/whatsnew/2.4.rst:1226
msgid ""
"A new :func:`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 ""
#: ../src/Doc/whatsnew/2.4.rst:1231
msgid ""
"Another new function: :func:`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 :func:`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 ""
#: ../src/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 ""
#: ../src/Doc/whatsnew/2.4.rst:1240
msgid ""
"The :mod:`poplib` module now supports POP over SSL. (Contributed by Hector "
"Urtubia.)"
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:1243
msgid ""
"The :mod:`profile` module can now profile C extension functions. "
"(Contributed by Nick Bastin.)"
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:1246
msgid ""
"The :mod:`random` module has a new method called :meth:`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 ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 :func:`getservbyport(port)` looks up "
"the service name for a given port number. (Contributed by Dave Cole and "
"Barry Warsaw.)"
msgstr ""
#: ../src/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 ""
#: ../src/Doc/whatsnew/2.4.rst:1284
msgid ""
"The :mod:`tarfile` module now generates GNU-format tar files by default. "
"(Contributed by Lars Gustaebel.)"
msgstr ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/Doc/whatsnew/2.4.rst:1314
msgid ""
"The :mod:`mpz`, :mod:`rotor`, and :mod:`xreadlines` modules have been "
"removed."
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:1323
msgid "cookielib"
msgstr ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/Doc/whatsnew/2.4.rst:1341
msgid "This module was contributed by John J. Lee."
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:1347
msgid "doctest"
msgstr ""
#: ../src/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 ""
#: ../src/Doc/whatsnew/2.4.rst:1354
msgid ""
"The new :class:`DocTestFinder` class extracts the tests from a given "
"object's docstrings::"
msgstr ""
#: ../src/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 ""
#: ../src/Doc/whatsnew/2.4.rst:1379
msgid "The above example produces the following output::"
msgstr ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/Doc/whatsnew/2.4.rst:1403
msgid "Another special string, ``<BLANKLINE>``, matches a blank line::"
msgstr ""
#: ../src/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 ""
#: ../src/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 ""
#: ../src/Doc/whatsnew/2.4.rst:1448
msgid "Some of the changes to Python's build process and to the C API are:"
msgstr ""
# f2e0ebe52e004c74af69a809500de003
#: ../src/Doc/whatsnew/2.4.rst:1450
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 ""
# 4ad7e5311ae34dfe80c4cdc9de6c87a3
#: ../src/Doc/whatsnew/2.4.rst:1454
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 ""
# 568de825d8ab40c49844090664457ce2
#: ../src/Doc/whatsnew/2.4.rst:1457
msgid ""
"A new function, :c:func:`PyTuple_Pack(N, obj1, obj2, ..., objN)`, constructs "
"tuples from a variable length argument list of Python objects. (Contributed "
"by Raymond Hettinger.)"
msgstr ""
# 033885125405485e82789549d08d09f6
#: ../src/Doc/whatsnew/2.4.rst:1461
msgid ""
"A new function, :c:func:`PyDict_Contains(d, k)`, implements fast dictionary "
"lookups without masking exceptions raised during the look-up process. "
"(Contributed by Raymond Hettinger.)"
msgstr ""
# 609750f0a33a4cdd999fefac1f9a3903
#: ../src/Doc/whatsnew/2.4.rst:1465
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 ""
# 09b9c6ca13eb433f97dada7cd2483393
#: ../src/Doc/whatsnew/2.4.rst:1468
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 ""
# dae9abb742544270b2a6f9f347d7856c
#: ../src/Doc/whatsnew/2.4.rst:1473
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 ""
# c31784e594d246ada984382556f94411
#: ../src/Doc/whatsnew/2.4.rst:1477
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 ""
#: ../src/Doc/whatsnew/2.4.rst:1482
msgid ""
"Python can now be built with additional profiling for the interpreter "
"itself, intended as an aid to people developing the Python core. Providing :"
"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, 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 ""
# 94ad83dc5f2240fba4e6e8df3c7dcada
#: ../src/Doc/whatsnew/2.4.rst:1492
msgid ""
"The :c:type:`tracebackobject` type has been renamed to :c:type:"
"`PyTracebackObject`."
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:1501
msgid ""
"The Windows port now builds under MSVC++ 7.1 as well as version 6. "
"(Contributed by Martin von Löwis.)"
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:1508
msgid "Porting to Python 2.4"
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:1513
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 ""
#: ../src/Doc/whatsnew/2.4.rst:1520
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 ""
#: ../src/Doc/whatsnew/2.4.rst:1524
msgid ""
"You can no longer compare the :class:`date` and :class:`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`."
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:1529
msgid ""
":func:`dircache.listdir` now passes exceptions to the caller instead of "
"returning empty lists."
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:1532
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 ""
#: ../src/Doc/whatsnew/2.4.rst:1536
msgid ""
":func:`fcntl.ioctl` now warns if the *mutate* argument is omitted and "
"relevant."
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:1539
msgid ""
"The :mod:`tarfile` module now generates GNU-format tar files by default."
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:1541
msgid ""
"Encountering a failure while importing a module no longer leaves a "
"partially- initialized module object in ``sys.modules``."
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:1544
msgid ""
":const:`None` is now a constant; code that binds a new value to the name "
"``None`` is now a syntax error."
msgstr ""
#: ../src/Doc/whatsnew/2.4.rst:1547
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 ""
# 7a25fd14be4d4ddfa0739f47b4ed71e3
#: ../src/Doc/whatsnew/2.4.rst:1559
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 ""
#: ../src/Doc/whatsnew/2.5.rst:3
msgid "What's New in Python 2.5"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:12
msgid ""
"This article explains the new features in Python 2.5. The final release of "
"Python 2.5 is scheduled for August 2006; :pep:`356` describes the planned "
"release schedule."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:16
msgid ""
"The changes in Python 2.5 are an interesting mix of language and library "
"improvements. The library enhancements will be more important to Python's "
"user community, I think, because several widely-useful packages were added. "
"New modules include ElementTree for XML processing (:mod:`xml.etree`), the "
"SQLite database module (:mod:`sqlite`), and the :mod:`ctypes` module for "
"calling C functions."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:23
msgid ""
"The language changes are of middling significance. Some pleasant new "
"features were added, but most of them aren't features that you'll use every "
"day. Conditional expressions were finally added to the language using a "
"novel syntax; see section :ref:`pep-308`. The new ':keyword:`with`' "
"statement will make writing cleanup code easier (section :ref:`pep-343`). "
"Values can now be passed into generators (section :ref:`pep-342`). Imports "
"are now visible as either absolute or relative (section :ref:`pep-328`). "
"Some corner cases of exception handling are handled better (section :ref:"
"`pep-341`). All these improvements are worthwhile, but they're improvements "
"to one specific language feature or another; none of them are broad "
"modifications to Python's semantics."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:34
msgid ""
"As well as the language and library additions, other improvements and "
"bugfixes were made throughout the source tree. A search through the SVN "
"change logs finds there were 353 patches applied and 458 bugs fixed between "
"Python 2.4 and 2.5. (Both figures are likely to be underestimates.)"
msgstr ""
# 3d655397a96646ad9c5ebe79795dc4da
#: ../src/Doc/whatsnew/2.5.rst:39
msgid ""
"This article doesn't try to be a complete specification of the new features; "
"instead changes are briefly introduced using helpful examples. For full "
"details, you should always refer to the documentation for Python 2.5 at "
"https://docs.python.org. If you want to understand the complete "
"implementation and design rationale, refer to the PEP for a particular new "
"feature."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:45
msgid ""
"Comments, suggestions, and error reports for this document are welcome; "
"please e-mail them to the author or open a bug in the Python bug tracker."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:54
msgid "PEP 308: Conditional Expressions"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:56
msgid ""
"For a long time, people have been requesting a way to write conditional "
"expressions, which are expressions that return value A or value B depending "
"on whether a Boolean value is true or false. A conditional expression lets "
"you write a single assignment statement that has the same effect as the "
"following::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:66
msgid ""
"There have been endless tedious discussions of syntax on both python-dev and "
"comp.lang.python. A vote was even held that found the majority of voters "
"wanted conditional expressions in some form, but there was no syntax that "
"was preferred by a clear majority. Candidates included C's ``cond ? true_v : "
"false_v``, ``if cond then true_v else false_v``, and 16 other variations."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:72
msgid "Guido van Rossum eventually chose a surprising syntax::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:76
msgid ""
"Evaluation is still lazy as in existing Boolean expressions, so the order of "
"evaluation jumps around a bit. The *condition* expression in the middle is "
"evaluated first, and the *true_value* expression is evaluated only if the "
"condition was true. Similarly, the *false_value* expression is only "
"evaluated when the condition is false."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:82
msgid ""
"This syntax may seem strange and backwards; why does the condition go in the "
"*middle* of the expression, and not in the front as in C's ``c ? x : y``? "
"The decision was checked by applying the new syntax to the modules in the "
"standard library and seeing how the resulting code read. In many cases "
"where a conditional expression is used, one value seems to be the 'common "
"case' and one value is an 'exceptional case', used only on rarer occasions "
"when the condition isn't met. The conditional syntax makes this pattern a "
"bit more obvious::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:92
msgid ""
"I read the above statement as meaning \"here *contents* is usually assigned "
"a value of ``doc+'\\n'``; sometimes *doc* is empty, in which special case "
"an empty string is returned.\" I doubt I will use conditional expressions "
"very often where there isn't a clear common and uncommon case."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:97
msgid ""
"There was some discussion of whether the language should require surrounding "
"conditional expressions with parentheses. The decision was made to *not* "
"require parentheses in the Python language's grammar, but as a matter of "
"style I think you should always use them. Consider these two statements::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:108
msgid ""
"In the first version, I think a reader's eye might group the statement into "
"'level = 1', 'if logging', 'else 0', and think that the condition decides "
"whether the assignment to *level* is performed. The second version reads "
"better, in my opinion, because it makes it clear that the assignment is "
"always performed and the choice is being made between two values."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:114
msgid ""
"Another reason for including the brackets: a few odd combinations of list "
"comprehensions and lambdas could look like incorrect conditional "
"expressions. See :pep:`308` for some examples. If you put parentheses "
"around your conditional expressions, you won't run into this case."
msgstr ""
# 44df6b868c2b45c8801bd887744d5ac6
#: ../src/Doc/whatsnew/2.5.rst:122
msgid ":pep:`308` - Conditional Expressions"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:123
msgid ""
"PEP written by Guido van Rossum and Raymond D. Hettinger; implemented by "
"Thomas Wouters."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:132
msgid "PEP 309: Partial Function Application"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:134
msgid ""
"The :mod:`functools` module is intended to contain tools for functional-"
"style programming."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:137
msgid ""
"One useful tool in this module is the :func:`partial` function. For programs "
"written in a functional style, you'll sometimes want to construct variants "
"of existing functions that have some of the parameters filled in. Consider "
"a Python function ``f(a, b, c)``; you could create a new function ``g(b, "
"c)`` that was equivalent to ``f(1, b, c)``. This is called \"partial "
"function application\"."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:144
msgid ""
":func:`partial` takes the arguments ``(function, arg1, arg2, ... "
"kwarg1=value1, kwarg2=value2)``. The resulting object is callable, so you "
"can just call it to invoke *function* with the filled-in arguments."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:148
msgid "Here's a small but realistic example::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:160
msgid ""
"Here's another example, from a program that uses PyGTK. Here a context- "
"sensitive pop-up menu is being constructed dynamically. The callback "
"provided for the menu option is a partially applied version of the :meth:"
"`open_item` method, where the first argument has been provided. ::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:173
msgid ""
"Another function in the :mod:`functools` module is the :func:"
"`update_wrapper(wrapper, wrapped)` function that helps you write well- "
"behaved decorators. :func:`update_wrapper` copies the name, module, and "
"docstring attribute to a wrapper function so that tracebacks inside the "
"wrapped function are easier to understand. For example, you might write::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:186
msgid ""
":func:`wraps` is a decorator that can be used inside your own decorators to "
"copy the wrapped function's information. An alternate version of the "
"previous example would be::"
msgstr ""
# b9f178c3add74836a40f5068125026b3
#: ../src/Doc/whatsnew/2.5.rst:200
msgid ":pep:`309` - Partial Function Application"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:201
msgid ""
"PEP proposed and written by Peter Harris; implemented by Hye-Shik Chang and "
"Nick Coghlan, with adaptations by Raymond Hettinger."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:210
msgid "PEP 314: Metadata for Python Software Packages v1.1"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:212
msgid ""
"Some simple dependency support was added to Distutils. The :func:`setup` "
"function now has ``requires``, ``provides``, and ``obsoletes`` keyword "
"parameters. When you build a source distribution using the ``sdist`` "
"command, the dependency information will be recorded in the :file:`PKG-INFO` "
"file."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:217
msgid ""
"Another new keyword parameter is ``download_url``, which should be set to a "
"URL for the package's source code. This means it's now possible to look up "
"an entry in the package index, determine the dependencies for a package, and "
"download the required packages. ::"
msgstr ""
# 4f73b69675e440e9891cd4b9921e5bc6
#: ../src/Doc/whatsnew/2.5.rst:231
msgid ""
"Another new enhancement to the Python package index at https://pypi.python."
"org is storing source and binary archives for a package. The new :command:"
"`upload` Distutils command will upload a package to the repository."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:236
msgid ""
"Before a package can be uploaded, you must be able to build a distribution "
"using the :command:`sdist` Distutils command. Once that works, you can run "
"``python setup.py upload`` to add your package to the PyPI archive. "
"Optionally you can GPG-sign the package by supplying the :option:`--sign` "
"and :option:`--identity` options."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:242
msgid ""
"Package uploading was implemented by Martin von Löwis and Richard Jones."
msgstr ""
# 9cf9f1f0f5a747708d4f090e1cb5429f
#: ../src/Doc/whatsnew/2.5.rst:247
msgid ":pep:`314` - Metadata for Python Software Packages v1.1"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:248
msgid ""
"PEP proposed and written by A.M. Kuchling, Richard Jones, and Fred Drake; "
"implemented by Richard Jones and Fred Drake."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:257
msgid "PEP 328: Absolute and Relative Imports"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:259
msgid ""
"The simpler part of PEP 328 was implemented in Python 2.4: parentheses could "
"now be used to enclose the names imported from a module using the ``from ... "
"import ...`` statement, making it easier to import many different names."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:263
msgid ""
"The more complicated part has been implemented in Python 2.5: importing a "
"module can be specified to use absolute or package-relative imports. The "
"plan is to move toward making absolute imports the default in future "
"versions of Python."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:267
msgid "Let's say you have a package directory like this::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:274
msgid ""
"This defines a package named :mod:`pkg` containing the :mod:`pkg.main` and :"
"mod:`pkg.string` submodules."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:277
msgid ""
"Consider the code in the :file:`main.py` module. What happens if it "
"executes the statement ``import string``? In Python 2.4 and earlier, it "
"will first look in the package's directory to perform a relative import, "
"finds :file:`pkg/string.py`, imports the contents of that file as the :mod:"
"`pkg.string` module, and that module is bound to the name ``string`` in the :"
"mod:`pkg.main` module's namespace."
msgstr ""
# 3a91520103784786acd1a36e83f77dbc
#: ../src/Doc/whatsnew/2.5.rst:284
msgid ""
"That's fine if :mod:`pkg.string` was what you wanted. But what if you "
"wanted Python's standard :mod:`string` module? There's no clean way to "
"ignore :mod:`pkg.string` and look for the standard module; generally you had "
"to look at the contents of ``sys.modules``, which is slightly unclean. "
"Holger Krekel's :mod:`py.std` package provides a tidier way to perform "
"imports from the standard library, ``import py; py.std.string.join()``, but "
"that package isn't available on all Python installations."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:292
msgid ""
"Reading code which relies on relative imports is also less clear, because a "
"reader may be confused about which module, :mod:`string` or :mod:`pkg."
"string`, is intended to be used. Python users soon learned not to duplicate "
"the names of standard library modules in the names of their packages' "
"submodules, but you can't protect against having your submodule's name being "
"used for a new module added in a future version of Python."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:299
msgid ""
"In Python 2.5, you can switch :keyword:`import`'s behaviour to absolute "
"imports using a ``from __future__ import absolute_import`` directive. This "
"absolute- import behaviour will become the default in a future version "
"(probably Python 2.7). Once absolute imports are the default, ``import "
"string`` will always find the standard library's version. It's suggested "
"that users should begin using absolute imports as much as possible, so it's "
"preferable to begin writing ``from pkg import string`` in your code."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:307
msgid ""
"Relative imports are still possible by adding a leading period to the "
"module name when using the ``from ... import`` form::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:315
msgid ""
"This imports the :mod:`string` module relative to the current package, so "
"in :mod:`pkg.main` this will import *name1* and *name2* from :mod:`pkg."
"string`. Additional leading periods perform the relative import starting "
"from the parent of the current package. For example, code in the :mod:`A.B."
"C` module can do::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:324
msgid ""
"Leading periods cannot be used with the ``import modname`` form of the "
"import statement, only the ``from ... import`` form."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:331
msgid "PEP written by Aahz; implemented by Thomas Wouters."
msgstr ""
# 4450c6e258ae466f9a5f4ccec97826cf
#: ../src/Doc/whatsnew/2.5.rst:332
msgid "http://codespeak.net/py/current/doc/index.html"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:334
msgid ""
"The py library by Holger Krekel, which contains the :mod:`py.std` package."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:342
msgid "PEP 338: Executing Modules as Scripts"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:344
msgid ""
"The :option:`-m` switch added in Python 2.4 to execute a module as a script "
"gained a few more abilities. Instead of being implemented in C code inside "
"the Python interpreter, the switch now uses an implementation in a new "
"module, :mod:`runpy`."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:349
msgid ""
"The :mod:`runpy` module implements a more sophisticated import mechanism so "
"that it's now possible to run modules in a package such as :mod:`pychecker."
"checker`. The module also supports alternative import mechanisms such as "
"the :mod:`zipimport` module. This means you can add a .zip archive's path "
"to ``sys.path`` and then use the :option:`-m` switch to execute code from "
"the archive."
msgstr ""
# 9f099ecb8fab495aa0a4129a408eeb63
#: ../src/Doc/whatsnew/2.5.rst:358
msgid ":pep:`338` - Executing modules as scripts"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:360
msgid "PEP written and implemented by Nick Coghlan."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:368
msgid "PEP 341: Unified try/except/finally"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:370
msgid ""
"Until Python 2.5, the :keyword:`try` statement came in two flavours. You "
"could use a :keyword:`finally` block to ensure that code is always executed, "
"or one or more :keyword:`except` blocks to catch specific exceptions. You "
"couldn't combine both :keyword:`except` blocks and a :keyword:`finally` "
"block, because generating the right bytecode for the combined version was "
"complicated and it wasn't clear what the semantics of the combined statement "
"should be."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:377
msgid ""
"Guido van Rossum spent some time working with Java, which does support the "
"equivalent of combining :keyword:`except` blocks and a :keyword:`finally` "
"block, and this clarified what the statement should mean. In Python 2.5, "
"you can now write::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:393
msgid ""
"The code in *block-1* is executed. If the code raises an exception, the "
"various :keyword:`except` blocks are tested: if the exception is of class :"
"class:`Exception1`, *handler-1* is executed; otherwise if it's of class :"
"class:`Exception2`, *handler-2* is executed, and so forth. If no exception "
"is raised, the *else-block* is executed."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:399
msgid ""
"No matter what happened previously, the *final-block* is executed once the "
"code block is complete and any raised exceptions handled. Even if there's an "
"error in an exception handler or the *else-block* and a new exception is "
"raised, the code in the *final-block* is still run."
msgstr ""
# f8852f7480274b9099906e5ca5a41d8b
#: ../src/Doc/whatsnew/2.5.rst:406
msgid ":pep:`341` - Unifying try-except and try-finally"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:408
msgid "PEP written by Georg Brandl; implementation by Thomas Lee."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:416
msgid "PEP 342: New Generator Features"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:418
msgid ""
"Python 2.5 adds a simple way to pass values *into* a generator. As "
"introduced in Python 2.3, generators only produce output; once a generator's "
"code was invoked to create an iterator, there was no way to pass any new "
"information into the function when its execution is resumed. Sometimes the "
"ability to pass in some information would be useful. Hackish solutions to "
"this include making the generator's code look at a global variable and then "
"changing the global variable's value, or passing in some mutable object that "
"callers then modify."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:426
msgid "To refresh your memory of basic generators, here's a simple example::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:434
msgid ""
"When you call ``counter(10)``, the result is an iterator that returns the "
"values from 0 up to 9. On encountering the :keyword:`yield` statement, the "
"iterator returns the provided value and suspends the function's execution, "
"preserving the local variables. Execution resumes on the following call to "
"the iterator's :meth:`next` method, picking up after the :keyword:`yield` "
"statement."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:440
msgid ""
"In Python 2.3, :keyword:`yield` was a statement; it didn't return any "
"value. In 2.5, :keyword:`yield` is now an expression, returning a value "
"that can be assigned to a variable or otherwise operated on::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:446
msgid ""
"I recommend that you always put parentheses around a :keyword:`yield` "
"expression when you're doing something with the returned value, as in the "
"above example. The parentheses aren't always necessary, but it's easier to "
"always add them instead of having to remember when they're needed."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:451
msgid ""
"(:pep:`342` explains the exact rules, which are that a :keyword:`yield`\\ -"
"expression must always be parenthesized except when it occurs at the top-"
"level expression on the right-hand side of an assignment. This means you "
"can write ``val = yield i`` but have to use parentheses when there's an "
"operation, as in ``val = (yield i) + 12``.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:457
msgid ""
"Values are sent into a generator by calling its :meth:`send(value)` method. "
"The generator's code is then resumed and the :keyword:`yield` expression "
"returns the specified *value*. If the regular :meth:`next` method is "
"called, the :keyword:`yield` returns :const:`None`."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:462
msgid ""
"Here's the previous example, modified to allow changing the value of the "
"internal counter. ::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:475
msgid "And here's an example of changing the counter::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:492
msgid ""
":keyword:`yield` will usually return :const:`None`, so you should always "
"check for this case. Don't just use its value in expressions unless you're "
"sure that the :meth:`send` method will be the only method used to resume "
"your generator function."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:497
msgid ""
"In addition to :meth:`send`, there are two other new methods on generators:"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:499
msgid ""
":meth:`throw(type, value=None, traceback=None)` is used to raise an "
"exception inside the generator; the exception is raised by the :keyword:"
"`yield` expression where the generator's execution is paused."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:503
msgid ""
":meth:`close` raises a new :exc:`GeneratorExit` exception inside the "
"generator to terminate the iteration. On receiving this exception, the "
"generator's code must either raise :exc:`GeneratorExit` or :exc:"
"`StopIteration`. Catching the :exc:`GeneratorExit` exception and returning "
"a value is illegal and will trigger a :exc:`RuntimeError`; if the function "
"raises some other exception, that exception is propagated to the caller. :"
"meth:`close` will also be called by Python's garbage collector when the "
"generator is garbage-collected."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:511
msgid ""
"If you need to run cleanup code when a :exc:`GeneratorExit` occurs, I "
"suggest using a ``try: ... finally:`` suite instead of catching :exc:"
"`GeneratorExit`."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:514
msgid ""
"The cumulative effect of these changes is to turn generators from one-way "
"producers of information into both producers and consumers."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:517
msgid ""
"Generators also become *coroutines*, a more generalized form of subroutines. "
"Subroutines are entered at one point and exited at another point (the top of "
"the function, and a :keyword:`return` statement), but coroutines can be "
"entered, exited, and resumed at many different points (the :keyword:`yield` "
"statements). We'll have to figure out patterns for using coroutines "
"effectively in Python."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:523
msgid ""
"The addition of the :meth:`close` method has one side effect that isn't "
"obvious. :meth:`close` is called when a generator is garbage-collected, so "
"this means the generator's code gets one last chance to run before the "
"generator is destroyed. This last chance means that ``try...finally`` "
"statements in generators can now be guaranteed to work; the :keyword:"
"`finally` clause will now always get a chance to run. The syntactic "
"restriction that you couldn't mix :keyword:`yield` statements with a ``try..."
"finally`` suite has therefore been removed. This seems like a minor bit of "
"language trivia, but using generators and ``try...finally`` is actually "
"necessary in order to implement the :keyword:`with` statement described by "
"PEP 343. I'll look at this new statement in the following section."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:535
msgid ""
"Another even more esoteric effect of this change: previously, the :attr:"
"`gi_frame` attribute of a generator was always a frame object. It's now "
"possible for :attr:`gi_frame` to be ``None`` once the generator has been "
"exhausted."
msgstr ""
# bc9de8dd8258432b8ed1855a762f2bf5
#: ../src/Doc/whatsnew/2.5.rst:547
msgid ":pep:`342` - Coroutines via Enhanced Generators"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:544
msgid ""
"PEP written by Guido van Rossum and Phillip J. Eby; implemented by Phillip "
"J. Eby. Includes examples of some fancier uses of generators as coroutines."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:547
msgid ""
"Earlier versions of these features were proposed in :pep:`288` by Raymond "
"Hettinger and :pep:`325` by Samuele Pedroni."
msgstr ""
# a340fd7953dc4254a77bc4debe98858c
#: ../src/Doc/whatsnew/2.5.rst:550
msgid "http://en.wikipedia.org/wiki/Coroutine"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:551
msgid "The Wikipedia entry for coroutines."
msgstr ""
# 1e4cac8826054eac87902eff631e23ab
#: ../src/Doc/whatsnew/2.5.rst:552
msgid "http://www.sidhe.org/~dan/blog/archives/000178.html"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:554
msgid ""
"An explanation of coroutines from a Perl point of view, written by Dan "
"Sugalski."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:562 ../src/Doc/whatsnew/2.6.rst:244
msgid "PEP 343: The 'with' statement"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:564 ../src/Doc/whatsnew/2.6.rst:255
msgid ""
"The ':keyword:`with`' statement clarifies code that previously would use "
"``try...finally`` blocks to ensure that clean-up code is executed. In this "
"section, I'll discuss the statement as it will commonly be used. In the "
"next section, I'll examine the implementation details and show how to write "
"objects for use with this statement."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:570
msgid ""
"The ':keyword:`with`' statement is a new control-flow structure whose basic "
"structure is::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:576
msgid ""
"The expression is evaluated, and it should result in an object that supports "
"the context management protocol (that is, has :meth:`__enter__` and :meth:"
"`__exit__` methods."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:580 ../src/Doc/whatsnew/2.6.rst:271
msgid ""
"The object's :meth:`__enter__` is called before *with-block* is executed and "
"therefore can run set-up code. It also may return a value that is bound to "
"the name *variable*, if given. (Note carefully that *variable* is *not* "
"assigned the result of *expression*.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:585 ../src/Doc/whatsnew/2.6.rst:276
msgid ""
"After execution of the *with-block* is finished, the object's :meth:"
"`__exit__` method is called, even if the block raised an exception, and can "
"therefore run clean-up code."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:589
msgid ""
"To enable the statement in Python 2.5, you need to add the following "
"directive to your module::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:594
msgid "The statement will always be enabled in Python 2.6."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:596 ../src/Doc/whatsnew/2.6.rst:280
msgid ""
"Some standard Python objects now support the context management protocol and "
"can be used with the ':keyword:`with`' statement. File objects are one "
"example::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:604 ../src/Doc/whatsnew/2.6.rst:288
msgid ""
"After this statement has executed, the file object in *f* will have been "
"automatically closed, even if the :keyword:`for` loop raised an exception "
"part- way through the block."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:610 ../src/Doc/whatsnew/2.6.rst:294
msgid ""
"In this case, *f* is the same object created by :func:`open`, because :meth:"
"`file.__enter__` returns *self*."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:613 ../src/Doc/whatsnew/2.6.rst:297
msgid ""
"The :mod:`threading` module's locks and condition variables also support "
"the ':keyword:`with`' statement::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:621 ../src/Doc/whatsnew/2.6.rst:305
msgid ""
"The lock is acquired before the block is executed and always released once "
"the block is complete."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:624
msgid ""
"The new :func:`localcontext` function in the :mod:`decimal` module makes it "
"easy to save and restore the current decimal context, which encapsulates the "
"desired precision and rounding characteristics for computations::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:643 ../src/Doc/whatsnew/2.6.rst:327
msgid "Writing Context Managers"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:645 ../src/Doc/whatsnew/2.6.rst:329
msgid ""
"Under the hood, the ':keyword:`with`' statement is fairly complicated. Most "
"people will only use ':keyword:`with`' in company with existing objects and "
"don't need to know these details, so you can skip the rest of this section "
"if you like. Authors of new objects will need to understand the details of "
"the underlying implementation and should keep reading."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:651 ../src/Doc/whatsnew/2.6.rst:335
msgid "A high-level explanation of the context management protocol is:"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:653 ../src/Doc/whatsnew/2.6.rst:337
msgid ""
"The expression is evaluated and should result in an object called a "
"\"context manager\". The context manager must have :meth:`__enter__` and :"
"meth:`__exit__` methods."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:657
msgid ""
"The context manager's :meth:`__enter__` method is called. The value "
"returned is assigned to *VAR*. If no ``'as VAR'`` clause is present, the "
"value is simply discarded."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:661 ../src/Doc/whatsnew/2.6.rst:345
msgid "The code in *BLOCK* is executed."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:663
msgid ""
"If *BLOCK* raises an exception, the :meth:`__exit__(type, value, traceback)` "
"is called with the exception details, the same values returned by :func:`sys."
"exc_info`. The method's return value controls whether the exception is re-"
"raised: any false value re-raises the exception, and ``True`` will result in "
"suppressing it. You'll only rarely want to suppress the exception, because "
"if you do the author of the code containing the ':keyword:`with`' statement "
"will never realize anything went wrong."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:671 ../src/Doc/whatsnew/2.6.rst:356
msgid ""
"If *BLOCK* didn't raise an exception, the :meth:`__exit__` method is still "
"called, but *type*, *value*, and *traceback* are all ``None``."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:674 ../src/Doc/whatsnew/2.6.rst:359
msgid ""
"Let's think through an example. I won't present detailed code but will only "
"sketch the methods necessary for a database that supports transactions."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:677 ../src/Doc/whatsnew/2.6.rst:362
msgid ""
"(For people unfamiliar with database terminology: a set of changes to the "
"database are grouped into a transaction. Transactions can be either "
"committed, meaning that all the changes are written into the database, or "
"rolled back, meaning that the changes are all discarded and the database is "
"unchanged. See any database textbook for more information.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:683 ../src/Doc/whatsnew/2.6.rst:368
msgid ""
"Let's assume there's an object representing a database connection. Our goal "
"will be to let the user write code like this::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:692 ../src/Doc/whatsnew/2.6.rst:377
msgid ""
"The transaction should be committed if the code in the block runs flawlessly "
"or rolled back if there's an exception. Here's the basic interface for :"
"class:`DatabaseConnection` that I'll assume::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:705 ../src/Doc/whatsnew/2.6.rst:390
msgid ""
"The :meth:`__enter__` method is pretty easy, having only to start a new "
"transaction. For this application the resulting cursor object would be a "
"useful result, so the method will return it. The user can then add ``as "
"cursor`` to their ':keyword:`with`' statement to bind the cursor to a "
"variable name. ::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:717 ../src/Doc/whatsnew/2.6.rst:402
msgid ""
"The :meth:`__exit__` method is the most complicated because it's where most "
"of the work has to be done. The method has to check if an exception "
"occurred. If there was no exception, the transaction is committed. The "
"transaction is rolled back if there was an exception."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:722 ../src/Doc/whatsnew/2.6.rst:407
msgid ""
"In the code below, execution will just fall off the end of the function, "
"returning the default value of ``None``. ``None`` is false, so the "
"exception will be re-raised automatically. If you wished, you could be more "
"explicit and add a :keyword:`return` statement at the marked location. ::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:742 ../src/Doc/whatsnew/2.6.rst:427
msgid "The contextlib module"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:744
msgid ""
"The new :mod:`contextlib` module provides some functions and a decorator "
"that are useful for writing objects for use with the ':keyword:`with`' "
"statement."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:747 ../src/Doc/whatsnew/2.6.rst:432
msgid ""
"The decorator is called :func:`contextmanager`, and lets you write a single "
"generator function instead of defining a new class. The generator should "
"yield exactly one value. The code up to the :keyword:`yield` will be "
"executed as the :meth:`__enter__` method, and the value yielded will be the "
"method's return value that will get bound to the variable in the ':keyword:"
"`with`' statement's :keyword:`as` clause, if any. The code after the :"
"keyword:`yield` will be executed in the :meth:`__exit__` method. Any "
"exception raised in the block will be raised by the :keyword:`yield` "
"statement."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:756
msgid ""
"Our database example from the previous section could be written using this "
"decorator as::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:776
msgid ""
"The :mod:`contextlib` module also has a :func:`nested(mgr1, mgr2, ...)` "
"function that combines a number of context managers so you don't need to "
"write nested ':keyword:`with`' statements. In this example, the single ':"
"keyword:`with`' statement both starts a database transaction and acquires a "
"thread lock::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:785
msgid ""
"Finally, the :func:`closing(object)` function returns *object* so that it "
"can be bound to a variable, and calls ``object.close`` at the end of the "
"block. ::"
msgstr ""
# e053e0436b02480ca14a6934d94b391b
# 19cf1dc4e704498a854dc657dc843de2
#: ../src/Doc/whatsnew/2.5.rst:801 ../src/Doc/whatsnew/2.6.rst:487
msgid ":pep:`343` - The \"with\" statement"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:799 ../src/Doc/whatsnew/2.6.rst:485
msgid ""
"PEP written by Guido van Rossum and Nick Coghlan; implemented by Mike Bland, "
"Guido van Rossum, and Neal Norwitz. The PEP shows the code generated for a "
"':keyword:`with`' statement, which can be helpful in learning how the "
"statement works."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:804 ../src/Doc/whatsnew/2.6.rst:490
msgid "The documentation for the :mod:`contextlib` module."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:812
msgid "PEP 352: Exceptions as New-Style Classes"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:814
msgid ""
"Exception classes can now be new-style classes, not just classic classes, "
"and the built-in :exc:`Exception` class and all the standard built-in "
"exceptions (:exc:`NameError`, :exc:`ValueError`, etc.) are now new-style "
"classes."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:818
msgid ""
"The inheritance hierarchy for exceptions has been rearranged a bit. In 2.5, "
"the inheritance relationships are::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:827
msgid ""
"This rearrangement was done because people often want to catch all "
"exceptions that indicate program errors. :exc:`KeyboardInterrupt` and :exc:"
"`SystemExit` aren't errors, though, and usually represent an explicit action "
"such as the user hitting Control-C or code calling :func:`sys.exit`. A bare "
"``except:`` will catch all exceptions, so you commonly need to list :exc:"
"`KeyboardInterrupt` and :exc:`SystemExit` in order to re-raise them. The "
"usual pattern is::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:842
msgid ""
"In Python 2.5, you can now write ``except Exception`` to achieve the same "
"result, catching all the exceptions that usually indicate errors but "
"leaving :exc:`KeyboardInterrupt` and :exc:`SystemExit` alone. As in "
"previous versions, a bare ``except:`` still catches all exceptions."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:847
msgid ""
"The goal for Python 3.0 is to require any class raised as an exception to "
"derive from :exc:`BaseException` or some descendant of :exc:`BaseException`, "
"and future releases in the Python 2.x series may begin to enforce this "
"constraint. Therefore, I suggest you begin making all your exception classes "
"derive from :exc:`Exception` now. It's been suggested that the bare "
"``except:`` form should be removed in Python 3.0, but Guido van Rossum "
"hasn't decided whether to do this or not."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:855
msgid ""
"Raising of strings as exceptions, as in the statement ``raise \"Error "
"occurred\"``, is deprecated in Python 2.5 and will trigger a warning. The "
"aim is to be able to remove the string-exception feature in a few releases."
msgstr ""
# 830b836fa7d14a6dbcf462dfa9619f5f
#: ../src/Doc/whatsnew/2.5.rst:861
msgid ":pep:`352` - Required Superclass for Exceptions"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:863
msgid ""
"PEP written by Brett Cannon and Guido van Rossum; implemented by Brett "
"Cannon."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:871
msgid "PEP 353: Using ssize_t as the index type"
msgstr ""
# 71b5443da628447f95d10236438b9bb9
#: ../src/Doc/whatsnew/2.5.rst:873
msgid ""
"A wide-ranging change to Python's C API, using a new :c:type:`Py_ssize_t` "
"type definition instead of :c:type:`int`, will permit the interpreter to "
"handle more data on 64-bit platforms. This change doesn't affect Python's "
"capacity on 32-bit platforms."
msgstr ""
# c1e23fdb99ed40b08e77ceb44266dcd6
#: ../src/Doc/whatsnew/2.5.rst:878
msgid ""
"Various pieces of the Python interpreter used C's :c:type:`int` type to "
"store sizes or counts; for example, the number of items in a list or tuple "
"were stored in an :c:type:`int`. The C compilers for most 64-bit platforms "
"still define :c:type:`int` as a 32-bit type, so that meant that lists could "
"only hold up to ``2**31 - 1`` = 2147483647 items. (There are actually a few "
"different programming models that 64-bit C compilers can use -- see http://"
"www.unix.org/version2/whatsnew/lp64_wp.html for a discussion -- but the most "
"commonly available model leaves :c:type:`int` as 32 bits.)"
msgstr ""
# 5f7d94474eb2447e9a4cc3a4ed35e666
#: ../src/Doc/whatsnew/2.5.rst:887
msgid ""
"A limit of 2147483647 items doesn't really matter on a 32-bit platform "
"because you'll run out of memory before hitting the length limit. Each list "
"item requires space for a pointer, which is 4 bytes, plus space for a :c:"
"type:`PyObject` representing the item. 2147483647\\*4 is already more bytes "
"than a 32-bit address space can contain."
msgstr ""
# f16f78bdeebe45f19b44744f17c7beec
#: ../src/Doc/whatsnew/2.5.rst:893
msgid ""
"It's possible to address that much memory on a 64-bit platform, however. "
"The pointers for a list that size would only require 16 GiB of space, so "
"it's not unreasonable that Python programmers might construct lists that "
"large. Therefore, the Python interpreter had to be changed to use some type "
"other than :c:type:`int`, and this will be a 64-bit type on 64-bit "
"platforms. The change will cause incompatibilities on 64-bit machines, so "
"it was deemed worth making the transition now, while the number of 64-bit "
"users is still relatively small. (In 5 or 10 years, we may *all* be on 64-"
"bit machines, and the transition would be more painful then.)"
msgstr ""
# 916257bfcbba4a7a8a40bd01d6928ea1
#: ../src/Doc/whatsnew/2.5.rst:903
msgid ""
"This change most strongly affects authors of C extension modules. Python "
"strings and container types such as lists and tuples now use :c:type:"
"`Py_ssize_t` to store their size. Functions such as :c:func:`PyList_Size` "
"now return :c:type:`Py_ssize_t`. Code in extension modules may therefore "
"need to have some variables changed to :c:type:`Py_ssize_t`."
msgstr ""
# 09b5e20c7fff4d7faeb237aa4b58f34a
#: ../src/Doc/whatsnew/2.5.rst:909
msgid ""
"The :c:func:`PyArg_ParseTuple` and :c:func:`Py_BuildValue` functions have a "
"new conversion code, ``n``, for :c:type:`Py_ssize_t`. :c:func:"
"`PyArg_ParseTuple`'s ``s#`` and ``t#`` still output :c:type:`int` by "
"default, but you can define the macro :c:macro:`PY_SSIZE_T_CLEAN` before "
"including :file:`Python.h` to make them return :c:type:`Py_ssize_t`."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:915
msgid ""
":pep:`353` has a section on conversion guidelines that extension authors "
"should read to learn about supporting 64-bit platforms."
msgstr ""
# ef59a94a89ef476e92447af5649aa9eb
#: ../src/Doc/whatsnew/2.5.rst:920
msgid ":pep:`353` - Using ssize_t as the index type"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:922
msgid "PEP written and implemented by Martin von Löwis."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:930
msgid "PEP 357: The '__index__' method"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:932
msgid ""
"The NumPy developers had a problem that could only be solved by adding a new "
"special method, :meth:`__index__`. When using slice notation, as in "
"``[start:stop:step]``, the values of the *start*, *stop*, and *step* indexes "
"must all be either integers or long integers. NumPy defines a variety of "
"specialized integer types corresponding to unsigned and signed integers of "
"8, 16, 32, and 64 bits, but there was no way to signal that these types "
"could be used as slice indexes."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:940
msgid ""
"Slicing can't just use the existing :meth:`__int__` method because that "
"method is also used to implement coercion to integers. If slicing used :"
"meth:`__int__`, floating-point numbers would also become legal slice indexes "
"and that's clearly an undesirable behaviour."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:945
msgid ""
"Instead, a new special method called :meth:`__index__` was added. It takes "
"no arguments and returns an integer giving the slice index to use. For "
"example::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:952
msgid ""
"The return value must be either a Python integer or long integer. The "
"interpreter will check that the type returned is correct, and raises a :exc:"
"`TypeError` if this requirement isn't met."
msgstr ""
# c6fbe1c41df84f7e9fe66727428e6662
#: ../src/Doc/whatsnew/2.5.rst:956
msgid ""
"A corresponding :attr:`nb_index` slot was added to the C-level :c:type:"
"`PyNumberMethods` structure to let C extensions implement this protocol. :c:"
"func:`PyNumber_Index(obj)` can be used in extension code to call the :meth:"
"`__index__` function and retrieve its result."
msgstr ""
# e988ae9b4dbc4faca8d66d99621e4ba6
#: ../src/Doc/whatsnew/2.5.rst:963
msgid ":pep:`357` - Allowing Any Object to be Used for Slicing"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:965
msgid "PEP written and implemented by Travis Oliphant."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:975
msgid ""
"Here are all of the changes that Python 2.5 makes to the core Python "
"language."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:977
msgid ""
"The :class:`dict` type has a new hook for letting subclasses provide a "
"default value when a key isn't contained in the dictionary. When a key isn't "
"found, the dictionary's :meth:`__missing__(key)` method will be called. "
"This hook is used to implement the new :class:`defaultdict` class in the :"
"mod:`collections` module. The following example defines a dictionary that "
"returns zero for any missing key::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:992
msgid ""
"Both 8-bit and Unicode strings have new :meth:`partition(sep)` and :meth:"
"`rpartition(sep)` methods that simplify a common use case."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:995
msgid ""
"The :meth:`find(S)` method is often used to get an index which is then used "
"to slice the string and obtain the pieces that are before and after the "
"separator. :meth:`partition(sep)` condenses this pattern into a single "
"method call that returns a 3-tuple containing the substring before the "
"separator, the separator itself, and the substring after the separator. If "
"the separator isn't found, the first element of the tuple is the entire "
"string and the other two elements are empty. :meth:`rpartition(sep)` also "
"returns a 3-tuple but starts searching from the end of the string; the ``r`` "
"stands for 'reverse'."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1004
msgid "Some examples::"
msgstr "Quelques exemples ::"
#: ../src/Doc/whatsnew/2.5.rst:1017
msgid ""
"(Implemented by Fredrik Lundh following a suggestion by Raymond Hettinger.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1019
msgid ""
"The :meth:`startswith` and :meth:`endswith` methods of string types now "
"accept tuples of strings to check for. ::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1025
msgid "(Implemented by Georg Brandl following a suggestion by Tom Lynn.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1029
msgid ""
"The :func:`min` and :func:`max` built-in functions gained a ``key`` keyword "
"parameter analogous to the ``key`` argument for :meth:`sort`. This "
"parameter supplies a function that takes a single argument and is called for "
"every value in the list; :func:`min`/:func:`max` will return the element "
"with the smallest/largest return value from this function. For example, to "
"find the longest string in a list, you can do::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1042
msgid "(Contributed by Steven Bethard and Raymond Hettinger.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1044
msgid ""
"Two new built-in functions, :func:`any` and :func:`all`, evaluate whether an "
"iterator contains any true or false values. :func:`any` returns :const:"
"`True` if any value returned by the iterator is true; otherwise it will "
"return :const:`False`. :func:`all` returns :const:`True` only if all of the "
"values returned by the iterator evaluate as true. (Suggested by Guido van "
"Rossum, and implemented by Raymond Hettinger.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1051
msgid ""
"The result of a class's :meth:`__hash__` method can now be either a long "
"integer or a regular integer. If a long integer is returned, the hash of "
"that value is taken. In earlier versions the hash value was required to be "
"a regular integer, but in 2.5 the :func:`id` built-in was changed to always "
"return non-negative numbers, and users often seem to use ``id(self)`` in :"
"meth:`__hash__` methods (though this is discouraged)."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1060
msgid ""
"ASCII is now the default encoding for modules. It's now a syntax error if "
"a module contains string literals with 8-bit characters but doesn't have an "
"encoding declaration. In Python 2.4 this triggered a warning, not a syntax "
"error. See :pep:`263` for how to declare a module's encoding; for example, "
"you might add a line like this near the top of the source file::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1068
msgid ""
"A new warning, :class:`UnicodeWarning`, is triggered when you attempt to "
"compare a Unicode string and an 8-bit string that can't be converted to "
"Unicode using the default ASCII encoding. The result of the comparison is "
"false::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1080
msgid ""
"Previously this would raise a :class:`UnicodeDecodeError` exception, but in "
"2.5 this could result in puzzling problems when accessing a dictionary. If "
"you looked up ``unichr(128)`` and ``chr(128)`` was being used as a key, "
"you'd get a :class:`UnicodeDecodeError` exception. Other changes in 2.5 "
"resulted in this exception being raised instead of suppressed by the code "
"in :file:`dictobject.c` that implements dictionaries."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1087
msgid ""
"Raising an exception for such a comparison is strictly correct, but the "
"change might have broken code, so instead :class:`UnicodeWarning` was "
"introduced."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1090
msgid "(Implemented by Marc-André Lemburg.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1092
msgid ""
"One error that Python programmers sometimes make is forgetting to include "
"an :file:`__init__.py` module in a package directory. Debugging this mistake "
"can be confusing, and usually requires running Python with the :option:`-v` "
"switch to log all the paths searched. In Python 2.5, a new :exc:"
"`ImportWarning` warning is triggered when an import would have picked up a "
"directory as a package but no :file:`__init__.py` was found. This warning "
"is silently ignored by default; provide the :option:`-Wd` option when "
"running the Python executable to display the warning message. (Implemented "
"by Thomas Wouters.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1101
msgid ""
"The list of base classes in a class definition can now be empty. As an "
"example, this is now legal::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1107
msgid "(Implemented by Brett Cannon.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1115
msgid "Interactive Interpreter Changes"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1117
msgid ""
"In the interactive interpreter, ``quit`` and ``exit`` have long been "
"strings so that new users get a somewhat helpful message when they try to "
"quit::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1123
msgid ""
"In Python 2.5, ``quit`` and ``exit`` are now objects that still produce "
"string representations of themselves, but are also callable. Newbies who try "
"``quit()`` or ``exit()`` will now exit the interpreter as they expect. "
"(Implemented by Georg Brandl.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1128
msgid ""
"The Python executable now accepts the standard long options :option:`--"
"help` and :option:`--version`; on Windows, it also accepts the :option:`/?` "
"option for displaying a help message. (Implemented by Georg Brandl.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1140
msgid ""
"Several of the optimizations were developed at the NeedForSpeed sprint, an "
"event held in Reykjavik, Iceland, from May 21--28 2006. The sprint focused "
"on speed enhancements to the CPython implementation and was funded by EWT "
"LLC with local support from CCP Games. Those optimizations added at this "
"sprint are specially marked in the following list."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1146
msgid ""
"When they were introduced in Python 2.4, the built-in :class:`set` and :"
"class:`frozenset` types were built on top of Python's dictionary type. In "
"2.5 the internal data structure has been customized for implementing sets, "
"and as a result sets will use a third less memory and are somewhat faster. "
"(Implemented by Raymond Hettinger.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1152
msgid ""
"The speed of some Unicode operations, such as finding substrings, string "
"splitting, and character map encoding and decoding, has been improved. "
"(Substring search and splitting improvements were added by Fredrik Lundh and "
"Andrew Dalke at the NeedForSpeed sprint. Character maps were improved by "
"Walter Dörwald and Martin von Löwis.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1160
msgid ""
"The :func:`long(str, base)` function is now faster on long digit strings "
"because fewer intermediate results are calculated. The peak is for strings "
"of around 800--1000 digits where the function is 6 times faster. "
"(Contributed by Alan McIntyre and committed at the NeedForSpeed sprint.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1167
msgid ""
"It's now illegal to mix iterating over a file with ``for line in file`` and "
"calling the file object's :meth:`read`/:meth:`readline`/:meth:`readlines` "
"methods. Iteration uses an internal buffer and the :meth:`read\\*` methods "
"don't use that buffer. Instead they would return the data following the "
"buffer, causing the data to appear out of order. Mixing iteration and these "
"methods will now trigger a :exc:`ValueError` from the :meth:`read\\*` "
"method. (Implemented by Thomas Wouters.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1177
msgid ""
"The :mod:`struct` module now compiles structure format strings into an "
"internal representation and caches this representation, yielding a 20% "
"speedup. (Contributed by Bob Ippolito at the NeedForSpeed sprint.)"
msgstr ""
# d5120248c614478b9025911bdca63df6
#: ../src/Doc/whatsnew/2.5.rst:1181
msgid ""
"The :mod:`re` module got a 1 or 2% speedup by switching to Python's "
"allocator functions instead of the system's :c:func:`malloc` and :c:func:"
"`free`. (Contributed by Jack Diederich at the NeedForSpeed sprint.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1185
msgid ""
"The code generator's peephole optimizer now performs simple constant folding "
"in expressions. If you write something like ``a = 2+3``, the code generator "
"will do the arithmetic and produce code corresponding to ``a = 5``. "
"(Proposed and implemented by Raymond Hettinger.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1190
msgid ""
"Function calls are now faster because code objects now keep the most "
"recently finished frame (a \"zombie frame\") in an internal field of the "
"code object, reusing it the next time the code object is invoked. (Original "
"patch by Michael Hudson, modified by Armin Rigo and Richard Jones; committed "
"at the NeedForSpeed sprint.) Frame objects are also slightly smaller, which "
"may improve cache locality and reduce memory usage a bit. (Contributed by "
"Neal Norwitz.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1200
msgid ""
"Python's built-in exceptions are now new-style classes, a change that speeds "
"up instantiation considerably. Exception handling in Python 2.5 is "
"therefore about 30% faster than in 2.4. (Contributed by Richard Jones, Georg "
"Brandl and Sean Reifschneider at the NeedForSpeed sprint.)"
msgstr ""
# 15a44b60eae44bde9404c7521ce64476
#: ../src/Doc/whatsnew/2.5.rst:1205
msgid ""
"Importing now caches the paths tried, recording whether they exist or not "
"so that the interpreter makes fewer :c:func:`open` and :c:func:`stat` calls "
"on startup. (Contributed by Martin von Löwis and Georg Brandl.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1217
msgid "New, Improved, and Removed Modules"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1219
msgid ""
"The standard library received many enhancements and bug fixes in Python 2.5. "
"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 SVN logs for all the "
"details."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1224
msgid ""
"The :mod:`audioop` module now supports the a-LAW encoding, and the code for "
"u-LAW encoding has been improved. (Contributed by Lars Immisch.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1227
msgid ""
"The :mod:`codecs` module gained support for incremental codecs. The :func:"
"`codec.lookup` function now returns a :class:`CodecInfo` instance instead of "
"a tuple. :class:`CodecInfo` instances behave like a 4-tuple to preserve "
"backward compatibility but also have the attributes :attr:`encode`, :attr:"
"`decode`, :attr:`incrementalencoder`, :attr:`incrementaldecoder`, :attr:"
"`streamwriter`, and :attr:`streamreader`. Incremental codecs can receive "
"input and produce output in multiple chunks; the output is the same as if "
"the entire input was fed to the non-incremental codec. See the :mod:`codecs` "
"module documentation for details. (Designed and implemented by Walter "
"Dörwald.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1239
msgid ""
"The :mod:`collections` module gained a new type, :class:`defaultdict`, that "
"subclasses the standard :class:`dict` type. The new type mostly behaves "
"like a dictionary but constructs a default value when a key isn't present, "
"automatically adding it to the dictionary for the requested key value."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1244
msgid ""
"The first argument to :class:`defaultdict`'s constructor is a factory "
"function that gets called whenever a key is requested but not found. This "
"factory function receives no arguments, so you can use built-in type "
"constructors such as :func:`list` or :func:`int`. For example, you can "
"make an index of words based on their initial letter like this::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1260
msgid "Printing ``index`` results in the following output::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1268
msgid "(Contributed by Guido van Rossum.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1270
msgid ""
"The :class:`deque` double-ended queue type supplied by the :mod:"
"`collections` module now has a :meth:`remove(value)` method that removes the "
"first occurrence of *value* in the queue, raising :exc:`ValueError` if the "
"value isn't found. (Contributed by Raymond Hettinger.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1275
msgid ""
"New module: The :mod:`contextlib` module contains helper functions for use "
"with the new ':keyword:`with`' statement. See section :ref:`contextlibmod` "
"for more about this module."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1279
msgid ""
"New module: The :mod:`cProfile` module is a C implementation of the "
"existing :mod:`profile` module that has much lower overhead. The module's "
"interface is the same as :mod:`profile`: you run ``cProfile.run('main()')`` "
"to profile a function, can save profile data to a file, etc. It's not yet "
"known if the Hotshot profiler, which is also written in C but doesn't match "
"the :mod:`profile` module's interface, will continue to be maintained in "
"future versions of Python. (Contributed by Armin Rigo.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1287
msgid ""
"Also, the :mod:`pstats` module for analyzing the data measured by the "
"profiler now supports directing the output to any file object by supplying a "
"*stream* argument to the :class:`Stats` constructor. (Contributed by Skip "
"Montanaro.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1291
msgid ""
"The :mod:`csv` module, which parses files in comma-separated value format, "
"received several enhancements and a number of bugfixes. You can now set the "
"maximum size in bytes of a field by calling the :meth:`csv."
"field_size_limit(new_limit)` function; omitting the *new_limit* argument "
"will return the currently-set limit. The :class:`reader` class now has a :"
"attr:`line_num` attribute that counts the number of physical lines read from "
"the source; records can span multiple physical lines, so :attr:`line_num` is "
"not the same as the number of records read."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1300
msgid ""
"The CSV parser is now stricter about multi-line quoted fields. Previously, "
"if a line ended within a quoted field without a terminating newline "
"character, a newline would be inserted into the returned field. This "
"behavior caused problems when reading files that contained carriage return "
"characters within fields, so the code was changed to return the field "
"without inserting newlines. As a consequence, if newlines embedded within "
"fields are important, the input should be split into lines in a manner that "
"preserves the newline characters."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1308
msgid "(Contributed by Skip Montanaro and Andrew McNamara.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1310
msgid ""
"The :class:`datetime` class in the :mod:`datetime` module now has a :meth:"
"`strptime(string, format)` method for parsing date strings, contributed by "
"Josh Spoerri. It uses the same format characters as :func:`time.strptime` "
"and :func:`time.strftime`::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1320
msgid ""
"The :meth:`SequenceMatcher.get_matching_blocks` method in the :mod:`difflib` "
"module now guarantees to return a minimal list of blocks describing matching "
"subsequences. Previously, the algorithm would occasionally break a block of "
"matching elements into two list entries. (Enhancement by Tim Peters.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1325
msgid ""
"The :mod:`doctest` module gained a ``SKIP`` option that keeps an example "
"from being executed at all. This is intended for code snippets that are "
"usage examples intended for the reader and aren't actually test cases."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1329
msgid ""
"An *encoding* parameter was added to the :func:`testfile` function and the :"
"class:`DocFileSuite` class to specify the file's encoding. This makes it "
"easier to use non-ASCII characters in tests contained within a docstring. "
"(Contributed by Bjorn Tillenius.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1336
msgid ""
"The :mod:`email` package has been updated to version 4.0. (Contributed by "
"Barry Warsaw.)"
msgstr ""
# d89738fcfb01402488338d9950a4ab82
#: ../src/Doc/whatsnew/2.5.rst:1344
msgid ""
"The :mod:`fileinput` module was made more flexible. Unicode filenames are "
"now supported, and a *mode* parameter that defaults to ``\"r\"`` was added "
"to the :func:`input` function to allow opening files in binary or :term:"
"`universal newlines` mode. Another new parameter, *openhook*, lets you use "
"a function other than :func:`open` to open the input files. Once you're "
"iterating over the set of files, the :class:`FileInput` object's new :meth:"
"`fileno` returns the file descriptor for the currently opened file. "
"(Contributed by Georg Brandl.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1353
msgid ""
"In the :mod:`gc` module, the new :func:`get_count` function returns a 3-"
"tuple containing the current collection counts for the three GC "
"generations. This is accounting information for the garbage collector; when "
"these counts reach a specified threshold, a garbage collection sweep will be "
"made. The existing :func:`gc.collect` function now takes an optional "
"*generation* argument of 0, 1, or 2 to specify which generation to collect. "
"(Contributed by Barry Warsaw.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1360
msgid ""
"The :func:`nsmallest` and :func:`nlargest` functions in the :mod:`heapq` "
"module now support a ``key`` keyword parameter similar to the one provided "
"by the :func:`min`/:func:`max` functions and the :meth:`sort` methods. For "
"example::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1374
msgid ""
"The :func:`itertools.islice` function now accepts ``None`` for the start and "
"step arguments. This makes it more compatible with the attributes of slice "
"objects, so that you can now write the following::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1383
msgid ""
"The :func:`format` function in the :mod:`locale` module has been modified "
"and two new functions were added, :func:`format_string` and :func:`currency`."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1386
msgid ""
"The :func:`format` function's *val* parameter could previously be a string "
"as long as no more than one %char specifier appeared; now the parameter must "
"be exactly one %char specifier with no surrounding text. An optional "
"*monetary* parameter was also added which, if ``True``, will use the "
"locale's rules for formatting currency in placing a separator between groups "
"of three digits."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1392
msgid ""
"To format strings with multiple %char specifiers, use the new :func:"
"`format_string` function that works like :func:`format` but also supports "
"mixing %char specifiers with arbitrary text."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1396
msgid ""
"A new :func:`currency` function was also added that formats a number "
"according to the current locale's settings."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1399
msgid "(Contributed by Georg Brandl.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1403
msgid ""
"The :mod:`mailbox` module underwent a massive rewrite to add the capability "
"to modify mailboxes in addition to reading them. A new set of classes that "
"include :class:`mbox`, :class:`MH`, and :class:`Maildir` are used to read "
"mailboxes, and have an :meth:`add(message)` method to add messages, :meth:"
"`remove(key)` to remove messages, and :meth:`lock`/:meth:`unlock` to lock/"
"unlock the mailbox. The following example converts a maildir-format mailbox "
"into an mbox-format one::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1421
msgid ""
"(Contributed by Gregory K. Johnson. Funding was provided by Google's 2005 "
"Summer of Code.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1424
msgid ""
"New module: the :mod:`msilib` module allows creating Microsoft Installer :"
"file:`.msi` files and CAB files. Some support for reading the :file:`.msi` "
"database is also included. (Contributed by Martin von Löwis.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1428
msgid ""
"The :mod:`nis` module now supports accessing domains other than the system "
"default domain by supplying a *domain* argument to the :func:`nis.match` "
"and :func:`nis.maps` functions. (Contributed by Ben Bell.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1432
msgid ""
"The :mod:`operator` module's :func:`itemgetter` and :func:`attrgetter` "
"functions now support multiple fields. A call such as ``operator."
"attrgetter('a', 'b')`` will return a function that retrieves the :attr:`a` "
"and :attr:`b` attributes. Combining this new feature with the :meth:`sort` "
"method's ``key`` parameter lets you easily sort lists using multiple "
"fields. (Contributed by Raymond Hettinger.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1439
msgid ""
"The :mod:`optparse` module was updated to version 1.5.1 of the Optik "
"library. The :class:`OptionParser` class gained an :attr:`epilog` attribute, "
"a string that will be printed after the help message, and a :meth:`destroy` "
"method to break reference cycles created by the object. (Contributed by Greg "
"Ward.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1444
msgid ""
"The :mod:`os` module underwent several changes. The :attr:"
"`stat_float_times` variable now defaults to true, meaning that :func:`os."
"stat` will now return time values as floats. (This doesn't necessarily mean "
"that :func:`os.stat` will return times that are precise to fractions of a "
"second; not all systems support such precision.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1450
msgid ""
"Constants named :attr:`os.SEEK_SET`, :attr:`os.SEEK_CUR`, and :attr:`os."
"SEEK_END` have been added; these are the parameters to the :func:`os.lseek` "
"function. Two new constants for locking are :attr:`os.O_SHLOCK` and :attr:"
"`os.O_EXLOCK`."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1455
msgid ""
"Two new functions, :func:`wait3` and :func:`wait4`, were added. They're "
"similar the :func:`waitpid` function which waits for a child process to exit "
"and returns a tuple of the process ID and its exit status, but :func:`wait3` "
"and :func:`wait4` return additional information. :func:`wait3` doesn't take "
"a process ID as input, so it waits for any child process to exit and returns "
"a 3-tuple of *process-id*, *exit-status*, *resource-usage* as returned from "
"the :func:`resource.getrusage` function. :func:`wait4(pid)` does take a "
"process ID. (Contributed by Chad J. Schroeder.)"
msgstr ""
# e1750dab488d44e3b9a4374c8405db10
#: ../src/Doc/whatsnew/2.5.rst:1464
msgid ""
"On FreeBSD, the :func:`os.stat` function now returns times with nanosecond "
"resolution, and the returned object now has :attr:`st_gen` and :attr:"
"`st_birthtime`. The :attr:`st_flags` attribute is also available, if the "
"platform supports it. (Contributed by Antti Louko and Diego Pettenò.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1471
msgid ""
"The Python debugger provided by the :mod:`pdb` module can now store lists of "
"commands to execute when a breakpoint is reached and execution stops. Once "
"breakpoint #1 has been created, enter ``commands 1`` and enter a series of "
"commands to be executed, finishing the list with ``end``. The command list "
"can include commands that resume execution, such as ``continue`` or "
"``next``. (Contributed by Grégoire Dooms.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1480
msgid ""
"The :mod:`pickle` and :mod:`cPickle` modules no longer accept a return value "
"of ``None`` from the :meth:`__reduce__` method; the method must return a "
"tuple of arguments instead. The ability to return ``None`` was deprecated "
"in Python 2.4, so this completes the removal of the feature."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1485
msgid ""
"The :mod:`pkgutil` module, containing various utility functions for finding "
"packages, was enhanced to support PEP 302's import hooks and now also works "
"for packages stored in ZIP-format archives. (Contributed by Phillip J. Eby.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1489
msgid ""
"The pybench benchmark suite by Marc-André Lemburg is now included in the :"
"file:`Tools/pybench` directory. The pybench suite is an improvement on the "
"commonly used :file:`pystone.py` program because pybench provides a more "
"detailed measurement of the interpreter's speed. It times particular "
"operations such as function calls, tuple slicing, method lookups, and "
"numeric operations, instead of performing many different operations and "
"reducing the result to a single number as :file:`pystone.py` does."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1497
msgid ""
"The :mod:`pyexpat` module now uses version 2.0 of the Expat parser. "
"(Contributed by Trent Mick.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1500
msgid ""
"The :class:`Queue` class provided by the :mod:`Queue` module gained two new "
"methods. :meth:`join` blocks until all items in the queue have been "
"retrieved and all processing work on the items have been completed. Worker "
"threads call the other new method, :meth:`task_done`, to signal that "
"processing for an item has been completed. (Contributed by Raymond "
"Hettinger.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1506
msgid ""
"The old :mod:`regex` and :mod:`regsub` modules, which have been deprecated "
"ever since Python 2.0, have finally been deleted. Other deleted modules: :"
"mod:`statcache`, :mod:`tzparse`, :mod:`whrandom`."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1510
msgid ""
"Also deleted: the :file:`lib-old` directory, which includes ancient modules "
"such as :mod:`dircmp` and :mod:`ni`, was removed. :file:`lib-old` wasn't on "
"the default ``sys.path``, so unless your programs explicitly added the "
"directory to ``sys.path``, this removal shouldn't affect your code."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1515
msgid ""
"The :mod:`rlcompleter` module is no longer dependent on importing the :mod:"
"`readline` module and therefore now works on non-Unix platforms. (Patch from "
"Robert Kiendl.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1521
msgid ""
"The :mod:`SimpleXMLRPCServer` and :mod:`DocXMLRPCServer` classes now have "
"a :attr:`rpc_paths` attribute that constrains XML-RPC operations to a "
"limited set of URL paths; the default is to allow only ``'/'`` and ``'/"
"RPC2'``. Setting :attr:`rpc_paths` to ``None`` or an empty tuple disables "
"this path checking."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1528
msgid ""
"The :mod:`socket` module now supports :const:`AF_NETLINK` sockets on Linux, "
"thanks to a patch from Philippe Biondi. Netlink sockets are a Linux-"
"specific mechanism for communications between a user-space process and "
"kernel code; an introductory article about them is at http://www."
"linuxjournal.com/article/7356. In Python code, netlink addresses are "
"represented as a tuple of 2 integers, ``(pid, group_mask)``."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1535
msgid ""
"Two new methods on socket objects, :meth:`recv_into(buffer)` and :meth:"
"`recvfrom_into(buffer)`, store the received data in an object that supports "
"the buffer protocol instead of returning the data as a string. This means "
"you can put the data directly into an array or a memory-mapped file."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1540
msgid ""
"Socket objects also gained :meth:`getfamily`, :meth:`gettype`, and :meth:"
"`getproto` accessor methods to retrieve the family, type, and protocol "
"values for the socket."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1544
msgid ""
"New module: the :mod:`spwd` module provides functions for accessing the "
"shadow password database on systems that support shadow passwords."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1547
msgid ""
"The :mod:`struct` is now faster because it compiles format strings into :"
"class:`Struct` objects with :meth:`pack` and :meth:`unpack` methods. This "
"is similar to how the :mod:`re` module lets you create compiled regular "
"expression objects. You can still use the module-level :func:`pack` and :"
"func:`unpack` functions; they'll create :class:`Struct` objects and cache "
"them. Or you can use :class:`Struct` instances directly::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1559
msgid ""
"You can also pack and unpack data to and from buffer objects directly using "
"the :meth:`pack_into(buffer, offset, v1, v2, ...)` and :meth:"
"`unpack_from(buffer, offset)` methods. This lets you store data directly "
"into an array or a memory- mapped file."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1564
msgid ""
"(:class:`Struct` objects were implemented by Bob Ippolito at the "
"NeedForSpeed sprint. Support for buffer objects was added by Martin Blais, "
"also at the NeedForSpeed sprint.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1568
msgid ""
"The Python developers switched from CVS to Subversion during the 2.5 "
"development process. Information about the exact build version is available "
"as the ``sys.subversion`` variable, a 3-tuple of ``(interpreter-name, branch-"
"name, revision-range)``. For example, at the time of writing my copy of 2.5 "
"was reporting ``('CPython', 'trunk', '45313:45315')``."
msgstr ""
# b9db240cbceb4310a219ac67963ce3cf
#: ../src/Doc/whatsnew/2.5.rst:1574
msgid ""
"This information is also available to C extensions via the :c:func:"
"`Py_GetBuildInfo` function that returns a string of build information like "
"this: ``\"trunk:45355:45356M, Apr 13 2006, 07:42:19\"``. (Contributed by "
"Barry Warsaw.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1579
msgid ""
"Another new function, :func:`sys._current_frames`, returns the current stack "
"frames for all running threads as a dictionary mapping thread identifiers to "
"the topmost stack frame currently active in that thread at the time the "
"function is called. (Contributed by Tim Peters.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1584
msgid ""
"The :class:`TarFile` class in the :mod:`tarfile` module now has an :meth:"
"`extractall` method that extracts all members from the archive into the "
"current working directory. It's also possible to set a different directory "
"as the extraction target, and to unpack only a subset of the archive's "
"members."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1589
msgid ""
"The compression used for a tarfile opened in stream mode can now be "
"autodetected using the mode ``'r|*'``. (Contributed by Lars Gustäbel.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1594
msgid ""
"The :mod:`threading` module now lets you set the stack size used when new "
"threads are created. The :func:`stack_size([*size*])` function returns the "
"currently configured stack size, and supplying the optional *size* parameter "
"sets a new value. Not all platforms support changing the stack size, but "
"Windows, POSIX threading, and OS/2 all do. (Contributed by Andrew MacIntyre.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1602
msgid ""
"The :mod:`unicodedata` module has been updated to use version 4.1.0 of the "
"Unicode character database. Version 3.2.0 is required by some "
"specifications, so it's still available as :attr:`unicodedata.ucd_3_2_0`."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1606
msgid ""
"New module: the :mod:`uuid` module generates universally unique "
"identifiers (UUIDs) according to :rfc:`4122`. The RFC defines several "
"different UUID versions that are generated from a starting string, from "
"system properties, or purely randomly. This module contains a :class:`UUID` "
"class and functions named :func:`uuid1`, :func:`uuid3`, :func:`uuid4`, "
"and :func:`uuid5` to generate different versions of UUID. (Version 2 "
"UUIDs are not specified in :rfc:`4122` and are not supported by this "
"module.) ::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1631
msgid "(Contributed by Ka-Ping Yee.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1633
msgid ""
"The :mod:`weakref` module's :class:`WeakKeyDictionary` and :class:"
"`WeakValueDictionary` types gained new methods for iterating over the weak "
"references contained in the dictionary. :meth:`iterkeyrefs` and :meth:"
"`keyrefs` methods were added to :class:`WeakKeyDictionary`, and :meth:"
"`itervaluerefs` and :meth:`valuerefs` were added to :class:"
"`WeakValueDictionary`. (Contributed by Fred L. Drake, Jr.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1640
msgid ""
"The :mod:`webbrowser` module received a number of enhancements. It's now "
"usable as a script with ``python -m webbrowser``, taking a URL as the "
"argument; there are a number of switches to control the behaviour (:option:"
"`-n` for a new browser window, :option:`-t` for a new tab). New module-"
"level functions, :func:`open_new` and :func:`open_new_tab`, were added to "
"support this. The module's :func:`open` function supports an additional "
"feature, an *autoraise* parameter that signals whether to raise the open "
"window when possible. A number of additional browsers were added to the "
"supported list such as Firefox, Opera, Konqueror, and elinks. (Contributed "
"by Oleg Broytmann and Georg Brandl.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1652
msgid ""
"The :mod:`xmlrpclib` module now supports returning :class:`datetime` "
"objects for the XML-RPC date type. Supply ``use_datetime=True`` to the :"
"func:`loads` function or the :class:`Unmarshaller` class to enable this "
"feature. (Contributed by Skip Montanaro.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1659
msgid ""
"The :mod:`zipfile` module now supports the ZIP64 version of the format, "
"meaning that a .zip archive can now be larger than 4 GiB and can contain "
"individual files larger than 4 GiB. (Contributed by Ronald Oussoren.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1665
msgid ""
"The :mod:`zlib` module's :class:`Compress` and :class:`Decompress` objects "
"now support a :meth:`copy` method that makes a copy of the object's "
"internal state and returns a new :class:`Compress` or :class:`Decompress` "
"object. (Contributed by Chris AtLee.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1678
msgid "The ctypes package"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1680
msgid ""
"The :mod:`ctypes` package, written by Thomas Heller, has been added to the "
"standard library. :mod:`ctypes` lets you call arbitrary functions in "
"shared libraries or DLLs. Long-time users may remember the :mod:`dl` "
"module, which provides functions for loading shared libraries and calling "
"functions in them. The :mod:`ctypes` package is much fancier."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1686
msgid ""
"To load a shared library or DLL, you must create an instance of the :class:"
"`CDLL` class and provide the name or path of the shared library or DLL. Once "
"that's done, you can call arbitrary functions by accessing them as "
"attributes of the :class:`CDLL` object. ::"
msgstr ""
# 3d3bce29060846168b4a200db19ed169
#: ../src/Doc/whatsnew/2.5.rst:1696
msgid ""
"Type constructors for the various C types are provided: :func:`c_int`, :func:"
"`c_float`, :func:`c_double`, :func:`c_char_p` (equivalent to :c:type:`char "
"\\*`), and so forth. Unlike Python's types, the C versions are all mutable; "
"you can assign to their :attr:`value` attribute to change the wrapped "
"value. Python integers and strings will be automatically converted to the "
"corresponding C types, but for other types you must call the correct type "
"constructor. (And I mean *must*; getting it wrong will often result in the "
"interpreter crashing with a segmentation fault.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1705
msgid ""
"You shouldn't use :func:`c_char_p` with a Python string when the C function "
"will be modifying the memory area, because Python strings are supposed to "
"be immutable; breaking this rule will cause puzzling bugs. When you need a "
"modifiable memory area, use :func:`create_string_buffer`::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1714
msgid ""
"C functions are assumed to return integers, but you can set the :attr:"
"`restype` attribute of the function object to change this::"
msgstr ""
# 8853e016c7e5459e995d54f0a4cf52c2
#: ../src/Doc/whatsnew/2.5.rst:1723
msgid ""
":mod:`ctypes` also provides a wrapper for Python's C API as the ``ctypes."
"pythonapi`` object. This object does *not* release the global interpreter "
"lock before calling a function, because the lock must be held when calling "
"into the interpreter's code. There's a :class:`py_object()` type "
"constructor that will create a :c:type:`PyObject \\*` pointer. A simple "
"usage::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1736
msgid ""
"Don't forget to use :class:`py_object()`; if it's omitted you end up with a "
"segmentation fault."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1739
msgid ""
":mod:`ctypes` has been around for a while, but people still write and "
"distribution hand-coded extension modules because you can't rely on :mod:"
"`ctypes` being present. Perhaps developers will begin to write Python "
"wrappers atop a library accessed through :mod:`ctypes` instead of extension "
"modules, now that :mod:`ctypes` is included with core Python."
msgstr ""
# 436556085e924974bcb0ead093117018
#: ../src/Doc/whatsnew/2.5.rst:1748
msgid "http://starship.python.net/crew/theller/ctypes/"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1749
msgid "The ctypes web page, with a tutorial, reference, and FAQ."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1751
msgid "The documentation for the :mod:`ctypes` module."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1759
msgid "The ElementTree package"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1761
msgid ""
"A subset of Fredrik Lundh's ElementTree library for processing XML has been "
"added to the standard library as :mod:`xml.etree`. The available modules "
"are :mod:`ElementTree`, :mod:`ElementPath`, and :mod:`ElementInclude` from "
"ElementTree 1.2.6. The :mod:`cElementTree` accelerator module is also "
"included."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1767
msgid ""
"The rest of this section will provide a brief overview of using ElementTree. "
"Full documentation for ElementTree is available at http://effbot.org/zone/"
"element-index.htm."
msgstr ""
# 87602d6122a24ba0ab962019a7200afa
#: ../src/Doc/whatsnew/2.5.rst:1771
msgid ""
"ElementTree represents an XML document as a tree of element nodes. The text "
"content of the document is stored as the :attr:`text` and :attr:`tail` "
"attributes of (This is one of the major differences between ElementTree and "
"the Document Object Model; in the DOM there are many different types of "
"node, including :class:`TextNode`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1777
msgid ""
"The most commonly used parsing function is :func:`parse`, that takes either "
"a string (assumed to contain a filename) or a file-like object and returns "
"an :class:`ElementTree` instance::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1789
msgid ""
"Once you have an :class:`ElementTree` instance, you can call its :meth:"
"`getroot` method to get the root :class:`Element` node."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1792
msgid ""
"There's also an :func:`XML` function that takes a string literal and returns "
"an :class:`Element` node (not an :class:`ElementTree`). This function "
"provides a tidy way to incorporate XML fragments, approaching the "
"convenience of an XML literal::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1802
msgid ""
"Each XML element supports some dictionary-like and some list-like access "
"methods. Dictionary-like operations are used to access attribute values, "
"and list-like operations are used to access child nodes."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1807
msgid "Result"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1809
msgid "``elem[n]``"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1809
msgid "Returns n'th child element."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1811
msgid "``elem[m:n]``"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1811
msgid "Returns list of m'th through n'th child elements."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1814
msgid "``len(elem)``"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1814
msgid "Returns number of child elements."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1816
msgid "``list(elem)``"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1816
msgid "Returns list of child elements."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1818
msgid "``elem.append(elem2)``"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1818
msgid "Adds *elem2* as a child."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1820
msgid "``elem.insert(index, elem2)``"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1820
msgid "Inserts *elem2* at the specified location."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1822
msgid "``del elem[n]``"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1822
msgid "Deletes n'th child element."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1824
msgid "``elem.keys()``"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1824
msgid "Returns list of attribute names."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1826
msgid "``elem.get(name)``"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1826
msgid "Returns value of attribute *name*."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1828
msgid "``elem.set(name, value)``"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1828
msgid "Sets new value for attribute *name*."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1830
msgid "``elem.attrib``"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1830
msgid "Retrieves the dictionary containing attributes."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1833
msgid "``del elem.attrib[name]``"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1833
msgid "Deletes attribute *name*."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1836
msgid ""
"Comments and processing instructions are also represented as :class:"
"`Element` nodes. To check if a node is a comment or processing "
"instructions::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1844
msgid ""
"To generate XML output, you should call the :meth:`ElementTree.write` "
"method. Like :func:`parse`, it can take either a string or a file-like "
"object::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1854
msgid ""
"(Caution: the default encoding used for output is ASCII. For general XML "
"work, where an element's name may contain arbitrary Unicode characters, "
"ASCII isn't a very useful encoding because it will raise an exception if an "
"element's name contains any characters with values greater than 127. "
"Therefore, it's best to specify a different encoding such as UTF-8 that can "
"handle any Unicode character.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1861
msgid ""
"This section is only a partial description of the ElementTree interfaces. "
"Please read the package's official documentation for more details."
msgstr ""
# e5456267b8bb4926aeb8a5e742e5ba19
#: ../src/Doc/whatsnew/2.5.rst:1866
msgid "http://effbot.org/zone/element-index.htm"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1868
msgid "Official documentation for ElementTree."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1876
msgid "The hashlib package"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1878
msgid ""
"A new :mod:`hashlib` module, written by Gregory P. Smith, has been added to "
"replace the :mod:`md5` and :mod:`sha` modules. :mod:`hashlib` adds support "
"for additional secure hashes (SHA-224, SHA-256, SHA-384, and SHA-512). When "
"available, the module uses OpenSSL for fast platform optimized "
"implementations of algorithms."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1884
msgid ""
"The old :mod:`md5` and :mod:`sha` modules still exist as wrappers around "
"hashlib to preserve backwards compatibility. The new module's interface is "
"very close to that of the old modules, but not identical. The most "
"significant difference is that the constructor functions for creating new "
"hashing objects are named differently. ::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1913
msgid ""
"Once a hash object has been created, its methods are the same as before: :"
"meth:`update(string)` hashes the specified string into the current digest "
"state, :meth:`digest` and :meth:`hexdigest` return the digest value as a "
"binary string or a string of hex digits, and :meth:`copy` returns a new "
"hashing object with the same digest state."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1922
msgid "The documentation for the :mod:`hashlib` module."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1930
msgid "The sqlite3 package"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1932
msgid ""
"The pysqlite module (http://www.pysqlite.org), a wrapper for the SQLite "
"embedded database, has been added to the standard library under the package "
"name :mod:`sqlite3`."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1936
msgid ""
"SQLite is a C library that provides a lightweight disk-based database that "
"doesn't require a separate server process and allows accessing the database "
"using a nonstandard variant of the SQL query language. Some applications can "
"use SQLite for internal data storage. It's also possible to prototype an "
"application using SQLite and then port the code to a larger database such as "
"PostgreSQL or Oracle."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1943
msgid ""
"pysqlite was written by Gerhard Häring and provides a SQL interface "
"compliant with the DB-API 2.0 specification described by :pep:`249`."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1946
msgid ""
"If you're compiling the Python source yourself, note that the source tree "
"doesn't include the SQLite code, only the wrapper module. You'll need to "
"have the SQLite libraries and headers installed before compiling Python, and "
"the build process will compile the module when the necessary headers are "
"available."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1951
msgid ""
"To use the module, you must first create a :class:`Connection` object that "
"represents the database. Here the data will be stored in the :file:`/tmp/"
"example` file::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1957
msgid ""
"You can also supply the special name ``:memory:`` to create a database in "
"RAM."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1959
msgid ""
"Once you have a :class:`Connection`, you can create a :class:`Cursor` "
"object and call its :meth:`execute` method to perform SQL commands::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1973
msgid ""
"Usually your SQL operations will need to use values from Python variables. "
"You shouldn't assemble your query using Python's string operations because "
"doing so is insecure; it makes your program vulnerable to an SQL injection "
"attack."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1977
msgid ""
"Instead, use the DB-API's parameter substitution. Put ``?`` as a "
"placeholder wherever you want to use a value, and then provide a tuple of "
"values as the second argument to the cursor's :meth:`execute` method. "
"(Other database modules may use a different placeholder, such as ``%s`` or "
"``:1``.) For example::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:1997
msgid ""
"To retrieve data after executing a SELECT statement, you can either treat "
"the cursor as an iterator, call the cursor's :meth:`fetchone` method to "
"retrieve a single matching row, or call :meth:`fetchall` to get a list of "
"the matching rows."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:2002
msgid "This example uses the iterator form::"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:2015
msgid ""
"For more information about the SQL dialect supported by SQLite, see http://"
"www.sqlite.org."
msgstr ""
# 28bd56b521c643379873d250bce3185c
#: ../src/Doc/whatsnew/2.5.rst:2021
msgid "http://www.pysqlite.org"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:2022
msgid "The pysqlite web page."
msgstr ""
# c7b6fbf1cd804fecaaec1ccffb03ed54
#: ../src/Doc/whatsnew/2.5.rst:2025
msgid "http://www.sqlite.org"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:2025
msgid ""
"The SQLite web page; the documentation describes the syntax and the "
"available data types for the supported SQL dialect."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:2028
msgid "The documentation for the :mod:`sqlite3` module."
msgstr ""
# 600a74cd6fae439aa4359e637b6ca3e2
#: ../src/Doc/whatsnew/2.5.rst:2029
msgid ":pep:`249` - Database API Specification 2.0"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:2031
msgid "PEP written by Marc-André Lemburg."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:2039
msgid "The wsgiref package"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:2041
msgid ""
"The Web Server Gateway Interface (WSGI) v1.0 defines a standard interface "
"between web servers and Python web applications and is described in :pep:"
"`333`. The :mod:`wsgiref` package is a reference implementation of the WSGI "
"specification."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:2048
msgid ""
"The package includes a basic HTTP server that will run a WSGI application; "
"this server is useful for debugging but isn't intended for production use. "
"Setting up a server takes only a few lines of code::"
msgstr ""
# 408323c9907b4d0a9b95c8b61d85c287
#: ../src/Doc/whatsnew/2.5.rst:2067
msgid "http://www.wsgi.org"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:2068
msgid "A central web site for WSGI-related resources."
msgstr ""
# bb3e825577ea481c9cc484c15fa7f96b
#: ../src/Doc/whatsnew/2.5.rst:2069
msgid ":pep:`333` - Python Web Server Gateway Interface v1.0"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:2071
msgid "PEP written by Phillip J. Eby."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:2083
msgid ""
"The Python source tree was converted from CVS to Subversion, in a complex "
"migration procedure that was supervised and flawlessly carried out by Martin "
"von Löwis. The procedure was developed as :pep:`347`."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:2087
msgid ""
"Coverity, a company that markets a source code analysis tool called Prevent, "
"provided the results of their examination of the Python source code. The "
"analysis found about 60 bugs that were quickly fixed. Many of the bugs "
"were refcounting problems, often occurring in error-handling code. See "
"http://scan.coverity.com for the statistics."
msgstr ""
# be7c9b816d234f39a2b3ac047aa80625
#: ../src/Doc/whatsnew/2.5.rst:2093
msgid ""
"The largest change to the C API came from :pep:`353`, which modifies the "
"interpreter to use a :c:type:`Py_ssize_t` type definition instead of :c:type:"
"`int`. See the earlier section :ref:`pep-353` for a discussion of this "
"change."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:2098
msgid ""
"The design of the bytecode compiler has changed a great deal, no longer "
"generating bytecode by traversing the parse tree. Instead the parse tree is "
"converted to an abstract syntax tree (or AST), and it is the abstract "
"syntax tree that's traversed to produce the bytecode."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:2103
msgid ""
"It's possible for Python code to obtain AST objects by using the :func:"
"`compile` built-in and specifying ``_ast.PyCF_ONLY_AST`` as the value of "
"the *flags* parameter::"
msgstr ""
# 16fa4d6331f64b3fa184bb38e3a4630a
#: ../src/Doc/whatsnew/2.5.rst:2116
msgid ""
"No official documentation has been written for the AST code yet, but :pep:"
"`339` discusses the design. To start learning about the code, read the "
"definition of the various AST nodes in :file:`Parser/Python.asdl`. A Python "
"script reads this file and generates a set of C structure definitions in :"
"file:`Include/Python-ast.h`. The :c:func:`PyParser_ASTFromString` and :c:"
"func:`PyParser_ASTFromFile`, defined in :file:`Include/pythonrun.h`, take "
"Python source as input and return the root of an AST representing the "
"contents. This AST can then be turned into a code object by :c:func:"
"`PyAST_Compile`. For more information, read the source code, and then ask "
"questions on python-dev."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:2126
msgid ""
"The AST code was developed under Jeremy Hylton's management, and implemented "
"by (in alphabetical order) Brett Cannon, Nick Coghlan, Grant Edwards, John "
"Ehresman, Kurt Kaiser, Neal Norwitz, Tim Peters, Armin Rigo, and Neil "
"Schemenauer, plus the participants in a number of AST sprints at conferences "
"such as PyCon."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:2135
msgid ""
"Evan Jones's patch to obmalloc, first described in a talk at PyCon DC 2005, "
"was applied. Python 2.4 allocated small objects in 256K-sized arenas, but "
"never freed arenas. With this patch, Python will free arenas when they're "
"empty. The net effect is that on some platforms, when you allocate many "
"objects, Python's memory usage may actually drop when you delete them and "
"the memory may be returned to the operating system. (Implemented by Evan "
"Jones, and reworked by Tim Peters.)"
msgstr ""
# 8ea529d07a2c41d88cf8c41ec9cdbfe7
#: ../src/Doc/whatsnew/2.5.rst:2143
msgid ""
"Note that this change means extension modules must be more careful when "
"allocating memory. Python's API has many different functions for allocating "
"memory that are grouped into families. For example, :c:func:"
"`PyMem_Malloc`, :c:func:`PyMem_Realloc`, and :c:func:`PyMem_Free` are one "
"family that allocates raw memory, while :c:func:`PyObject_Malloc`, :c:func:"
"`PyObject_Realloc`, and :c:func:`PyObject_Free` are another family that's "
"supposed to be used for creating Python objects."
msgstr ""
# 5dd3ab361b1c4b729f37537fa09a3440
#: ../src/Doc/whatsnew/2.5.rst:2151
msgid ""
"Previously these different families all reduced to the platform's :c:func:"
"`malloc` and :c:func:`free` functions. This meant it didn't matter if you "
"got things wrong and allocated memory with the :c:func:`PyMem` function but "
"freed it with the :c:func:`PyObject` function. With 2.5's changes to "
"obmalloc, these families now do different things and mismatches will "
"probably result in a segfault. You should carefully test your C extension "
"modules with Python 2.5."
msgstr ""
# a614c73637b24c21b6c35647199cca66
#: ../src/Doc/whatsnew/2.5.rst:2158
msgid ""
"The built-in set types now have an official C API. Call :c:func:`PySet_New` "
"and :c:func:`PyFrozenSet_New` to create a new set, :c:func:`PySet_Add` and :"
"c:func:`PySet_Discard` to add and remove elements, and :c:func:"
"`PySet_Contains` and :c:func:`PySet_Size` to examine the set's state. "
"(Contributed by Raymond Hettinger.)"
msgstr ""
# a10c13ff90804ac9a25e7484b276440f
#: ../src/Doc/whatsnew/2.5.rst:2164
msgid ""
"C code can now obtain information about the exact revision of the Python "
"interpreter by calling the :c:func:`Py_GetBuildInfo` function that returns "
"a string of build information like this: ``\"trunk:45355:45356M, Apr 13 "
"2006, 07:42:19\"``. (Contributed by Barry Warsaw.)"
msgstr ""
# f265896c16084a17a80c42d29225c5cc
#: ../src/Doc/whatsnew/2.5.rst:2169
msgid ""
"Two new macros can be used to indicate C functions that are local to the "
"current file so that a faster calling convention can be used. :c:func:"
"`Py_LOCAL(type)` declares the function as returning a value of the specified "
"*type* and uses a fast-calling qualifier. :c:func:`Py_LOCAL_INLINE(type)` "
"does the same thing and also requests the function be inlined. If :c:func:"
"`PY_LOCAL_AGGRESSIVE` is defined before :file:`python.h` is included, a set "
"of more aggressive optimizations are enabled for the module; you should "
"benchmark the results to find out if these optimizations actually make the "
"code faster. (Contributed by Fredrik Lundh at the NeedForSpeed sprint.)"
msgstr ""
# c44153dc025143f69cf9ef610a172c31
#: ../src/Doc/whatsnew/2.5.rst:2180
msgid ""
":c:func:`PyErr_NewException(name, base, dict)` can now accept a tuple of "
"base classes as its *base* argument. (Contributed by Georg Brandl.)"
msgstr ""
# 9a44d20f34024a9481f4403ac3126174
#: ../src/Doc/whatsnew/2.5.rst:2183
msgid ""
"The :c:func:`PyErr_Warn` function for issuing warnings is now deprecated in "
"favour of :c:func:`PyErr_WarnEx(category, message, stacklevel)` which lets "
"you specify the number of stack frames separating this function and the "
"caller. A *stacklevel* of 1 is the function calling :c:func:`PyErr_WarnEx`, "
"2 is the function above that, and so forth. (Added by Neal Norwitz.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:2189
msgid ""
"The CPython interpreter is still written in C, but the code can now be "
"compiled with a C++ compiler without errors. (Implemented by Anthony "
"Baxter, Martin von Löwis, Skip Montanaro.)"
msgstr ""
# 5e6709ad2ebe41b385b59b26197b149d
#: ../src/Doc/whatsnew/2.5.rst:2193
msgid ""
"The :c:func:`PyRange_New` function was removed. It was never documented, "
"never used in the core code, and had dangerously lax error checking. In the "
"unlikely case that your extensions were using it, you can replace it by "
"something like the following::"
msgstr ""
# c13516f772bd43edb3fa1dd45a802057
#: ../src/Doc/whatsnew/2.5.rst:2209
msgid ""
"MacOS X (10.3 and higher): dynamic loading of modules now uses the :c:func:"
"`dlopen` function instead of MacOS-specific functions."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:2212
msgid ""
"MacOS X: an :option:`--enable-universalsdk` switch was added to the :program:"
"`configure` script that compiles the interpreter as a universal binary able "
"to run on both PowerPC and Intel processors. (Contributed by Ronald "
"Oussoren; :issue:`2573`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:2217
msgid ""
"Windows: :file:`.dll` is no longer supported as a filename extension for "
"extension modules. :file:`.pyd` is now the only filename extension that "
"will be searched for."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:2227
msgid "Porting to Python 2.5"
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:2232
msgid ""
"ASCII is now the default encoding for modules. It's now a syntax error if "
"a module contains string literals with 8-bit characters but doesn't have an "
"encoding declaration. In Python 2.4 this triggered a warning, not a syntax "
"error."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:2237
msgid ""
"Previously, the :attr:`gi_frame` attribute of a generator was always a frame "
"object. Because of the :pep:`342` changes described in section :ref:"
"`pep-342`, it's now possible for :attr:`gi_frame` to be ``None``."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:2241
msgid ""
"A new warning, :class:`UnicodeWarning`, is triggered when you attempt to "
"compare a Unicode string and an 8-bit string that can't be converted to "
"Unicode using the default ASCII encoding. Previously such comparisons would "
"raise a :class:`UnicodeDecodeError` exception."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:2246
msgid ""
"Library: the :mod:`csv` module is now stricter about multi-line quoted "
"fields. If your files contain newlines embedded within fields, the input "
"should be split into lines in a manner which preserves the newline "
"characters."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:2250
msgid ""
"Library: the :mod:`locale` module's :func:`format` function's would "
"previously accept any string as long as no more than one %char specifier "
"appeared. In Python 2.5, the argument must be exactly one %char specifier "
"with no surrounding text."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:2255
msgid ""
"Library: The :mod:`pickle` and :mod:`cPickle` modules no longer accept a "
"return value of ``None`` from the :meth:`__reduce__` method; the method must "
"return a tuple of arguments instead. The modules also no longer accept the "
"deprecated *bin* keyword parameter."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:2260
msgid ""
"Library: The :mod:`SimpleXMLRPCServer` and :mod:`DocXMLRPCServer` classes "
"now have a :attr:`rpc_paths` attribute that constrains XML-RPC operations to "
"a limited set of URL paths; the default is to allow only ``'/'`` and ``'/"
"RPC2'``. Setting :attr:`rpc_paths` to ``None`` or an empty tuple disables "
"this path checking."
msgstr ""
# 1a41165f43b64ba89028c1e74dce4e66
#: ../src/Doc/whatsnew/2.5.rst:2266
msgid ""
"C API: Many functions now use :c:type:`Py_ssize_t` instead of :c:type:`int` "
"to allow processing more data on 64-bit machines. Extension code may need "
"to make the same change to avoid warnings and to support 64-bit machines. "
"See the earlier section :ref:`pep-353` for a discussion of this change."
msgstr ""
# c1b1ba3ca0544ca4994e3f8508cb6413
#: ../src/Doc/whatsnew/2.5.rst:2271
msgid ""
"C API: The obmalloc changes mean that you must be careful to not mix usage "
"of the :c:func:`PyMem_\\*` and :c:func:`PyObject_\\*` families of functions. "
"Memory allocated with one family's :c:func:`\\*_Malloc` must be freed with "
"the corresponding family's :c:func:`\\*_Free` function."
msgstr ""
#: ../src/Doc/whatsnew/2.5.rst:2282
msgid ""
"The author would like to thank the following people for offering "
"suggestions, corrections and assistance with various drafts of this article: "
"Georg Brandl, Nick Coghlan, Phillip J. Eby, Lars Gustäbel, Raymond "
"Hettinger, Ralf W. Grosse- Kunstleve, Kent Johnson, Iain Lowe, Martin von "
"Löwis, Fredrik Lundh, Andrew McNamara, Skip Montanaro, Gustavo Niemeyer, "
"Paul Prescod, James Pryor, Mike Rovner, Scott Weikart, Barry Warsaw, Thomas "
"Wouters."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:3
msgid "What's New in Python 2.6"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:7 ../src/Doc/whatsnew/2.7.rst:5
msgid "A.M. Kuchling (amk at amk.ca)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:50
msgid ""
"This article explains the new features in Python 2.6, released on October 1 "
"2008. The release schedule is described in :pep:`361`."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:53
msgid ""
"The major theme of Python 2.6 is preparing the migration path to Python 3.0, "
"a major redesign of the language. Whenever possible, Python 2.6 "
"incorporates new features and syntax from 3.0 while remaining compatible "
"with existing code by not removing older features or syntax. When it's not "
"possible to do that, Python 2.6 tries to do what it can, adding "
"compatibility functions in a :mod:`future_builtins` module and a :option:"
"`-3` switch to warn about usages that will become unsupported in 3.0."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:62
msgid ""
"Some significant new packages have been added to the standard library, such "
"as the :mod:`multiprocessing` and :mod:`json` modules, but there aren't many "
"new features that aren't related to Python 3.0 in some way."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:67
msgid ""
"Python 2.6 also sees a number of improvements and bugfixes throughout the "
"source. A search through the change logs finds there were 259 patches "
"applied and 612 bugs fixed between Python 2.5 and 2.6. Both figures are "
"likely to be underestimates."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:72
msgid ""
"This article doesn't attempt to provide a complete specification of the new "
"features, but instead provides a convenient overview. For full details, you "
"should refer to the documentation for Python 2.6. If you want to understand "
"the rationale for the design and implementation, refer to the PEP for a "
"particular new feature. Whenever possible, \"What's New in Python\" links to "
"the bug/patch item for each change."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:88
msgid "Python 3.0"
msgstr "Python 3.0"
#: ../src/Doc/whatsnew/2.6.rst:90
msgid ""
"The development cycle for Python versions 2.6 and 3.0 was synchronized, with "
"the alpha and beta releases for both versions being made on the same days. "
"The development of 3.0 has influenced many features in 2.6."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:95
msgid ""
"Python 3.0 is a far-ranging redesign of Python that breaks compatibility "
"with the 2.x series. This means that existing Python code will need some "
"conversion in order to run on Python 3.0. However, not all the changes in "
"3.0 necessarily break compatibility. In cases where new features won't "
"cause existing code to break, they've been backported to 2.6 and are "
"described in this document in the appropriate place. Some of the 3.0-"
"derived features are:"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:104
msgid ""
"A :meth:`__complex__` method for converting objects to a complex number."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:105
msgid "Alternate syntax for catching exceptions: ``except TypeError as exc``."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:106
msgid ""
"The addition of :func:`functools.reduce` as a synonym for the built-in :func:"
"`reduce` function."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:109
msgid ""
"Python 3.0 adds several new built-in functions and changes the semantics of "
"some existing builtins. Functions that are new in 3.0 such as :func:`bin` "
"have simply been added to Python 2.6, but existing builtins haven't been "
"changed; instead, the :mod:`future_builtins` module has versions with the "
"new 3.0 semantics. Code written to be compatible with 3.0 can do ``from "
"future_builtins import hex, map`` as necessary."
msgstr ""
# fc2b4510b4a54f74af5d89342e3260cb
#: ../src/Doc/whatsnew/2.6.rst:117
msgid ""
"A new command-line switch, :option:`-3`, enables warnings about features "
"that will be removed in Python 3.0. You can run code with this switch to "
"see how much work will be necessary to port code to 3.0. The value of this "
"switch is available to Python code as the boolean variable :data:`sys."
"py3kwarning`, and to C extension code as :c:data:`Py_Py3kWarningFlag`."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:126
msgid ""
"The 3xxx series of PEPs, which contains proposals for Python 3.0. :pep:"
"`3000` describes the development process for Python 3.0. Start with :pep:"
"`3100` that describes the general goals for Python 3.0, and then explore the "
"higher-numbered PEPS that propose specific features."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:134
msgid "Changes to the Development Process"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:136
msgid ""
"While 2.6 was being developed, the Python development process underwent two "
"significant changes: we switched from SourceForge's issue tracker to a "
"customized Roundup installation, and the documentation was converted from "
"LaTeX to reStructuredText."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:143
msgid "New Issue Tracker: Roundup"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:145
msgid ""
"For a long time, the Python developers had been growing increasingly annoyed "
"by SourceForge's bug tracker. SourceForge's hosted solution doesn't permit "
"much customization; for example, it wasn't possible to customize the life "
"cycle of issues."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:150
msgid ""
"The infrastructure committee of the Python Software Foundation therefore "
"posted a call for issue trackers, asking volunteers to set up different "
"products and import some of the bugs and patches from SourceForge. Four "
"different trackers were examined: `Jira <http://www.atlassian.com/software/"
"jira/>`__, `Launchpad <http://www.launchpad.net>`__, `Roundup <http://"
"roundup.sourceforge.net/>`__, and `Trac <http://trac.edgewall.org/>`__. The "
"committee eventually settled on Jira and Roundup as the two candidates. "
"Jira is a commercial product that offers no-cost hosted instances to free-"
"software projects; Roundup is an open-source project that requires "
"volunteers to administer it and a server to host it."
msgstr ""
# 5d3b5e5e4f0644e99aa2dc801015f475
#: ../src/Doc/whatsnew/2.6.rst:164
msgid ""
"After posting a call for volunteers, a new Roundup installation was set up "
"at https://bugs.python.org. One installation of Roundup can host multiple "
"trackers, and this server now also hosts issue trackers for Jython and for "
"the Python web site. It will surely find other uses in the future. Where "
"possible, this edition of \"What's New in Python\" links to the bug/patch "
"item for each change."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:172
msgid ""
"Hosting of the Python bug tracker is kindly provided by `Upfront Systems "
"<http://www.upfrontsystems.co.za/>`__ of Stellenbosch, South Africa. Martin "
"von Loewis put a lot of effort into importing existing bugs and patches from "
"SourceForge; his scripts for this import operation are at http://svn.python."
"org/view/tracker/importer/ and may be useful to other projects wishing to "
"move from SourceForge to Roundup."
msgstr ""
# eab68856fd3c449dac2be43770897fc3
#: ../src/Doc/whatsnew/2.6.rst:182
msgid "https://bugs.python.org"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:183
msgid "The Python bug tracker."
msgstr ""
# 357cae7398a04266ad88d3e3bf9f4da8
#: ../src/Doc/whatsnew/2.6.rst:185
msgid "http://bugs.jython.org:"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:186
msgid "The Jython bug tracker."
msgstr ""
# c2e5487be1e446dba854c029923c7aa9
#: ../src/Doc/whatsnew/2.6.rst:188
msgid "http://roundup.sourceforge.net/"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:189
msgid "Roundup downloads and documentation."
msgstr ""
# 6f10dc51f6e5404698e588a7c727432e
#: ../src/Doc/whatsnew/2.6.rst:190
msgid "http://svn.python.org/view/tracker/importer/"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:192
msgid "Martin von Loewis's conversion scripts."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:195
msgid "New Documentation Format: reStructuredText Using Sphinx"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:197
msgid ""
"The Python documentation was written using LaTeX since the project started "
"around 1989. In the 1980s and early 1990s, most documentation was printed "
"out for later study, not viewed online. LaTeX was widely used because it "
"provided attractive printed output while remaining straightforward to write "
"once the basic rules of the markup were learned."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:204
msgid ""
"Today LaTeX is still used for writing publications destined for printing, "
"but the landscape for programming tools has shifted. We no longer print out "
"reams of documentation; instead, we browse through it online and HTML has "
"become the most important format to support. Unfortunately, converting LaTeX "
"to HTML is fairly complicated and Fred L. Drake Jr., the long-time Python "
"documentation editor, spent a lot of time maintaining the conversion "
"process. Occasionally people would suggest converting the documentation "
"into SGML and later XML, but performing a good conversion is a major task "
"and no one ever committed the time required to finish the job."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:215
msgid ""
"During the 2.6 development cycle, Georg Brandl put a lot of effort into "
"building a new toolchain for processing the documentation. The resulting "
"package is called Sphinx, and is available from http://sphinx.pocoo.org/."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:220
msgid ""
"Sphinx concentrates on HTML output, producing attractively styled and modern "
"HTML; printed output is still supported through conversion to LaTeX. The "
"input format is reStructuredText, a markup syntax supporting custom "
"extensions and directives that is commonly used in the Python community."
msgstr ""
# abd8b71b55244f43be28272c7109c5cb
#: ../src/Doc/whatsnew/2.6.rst:226
msgid ""
"Sphinx is a standalone package that can be used for writing, and almost two "
"dozen other projects (`listed on the Sphinx web site <http://sphinx-doc.org/"
"examples.html>`__) have adopted Sphinx as their documentation tool."
msgstr ""
# d0af77b8e20b48b5b1283ba07b12d040
#: ../src/Doc/whatsnew/2.6.rst:233
msgid ""
"`Documenting Python <https://docs.python.org/devguide/documenting.html>`__"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:234
msgid "Describes how to write for Python's documentation."
msgstr ""
# fb491a6bc2b7466c93968451ed450809
#: ../src/Doc/whatsnew/2.6.rst:236
msgid "`Sphinx <http://sphinx-doc.org/>`__"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:237
msgid "Documentation and code for the Sphinx toolchain."
msgstr ""
# a7c0dc5d5c194ed487dc221ca847d717
#: ../src/Doc/whatsnew/2.6.rst:238
msgid "`Docutils <http://docutils.sourceforge.net>`__"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:240
msgid "The underlying reStructuredText parser and toolset."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:246
msgid ""
"The previous version, Python 2.5, added the ':keyword:`with`' statement as "
"an optional feature, to be enabled by a ``from __future__ import "
"with_statement`` directive. In 2.6 the statement no longer needs to be "
"specially enabled; this means that :keyword:`with` is now always a keyword. "
"The rest of this section is a copy of the corresponding section from the "
"\"What's New in Python 2.5\" document; if you're familiar with the ':keyword:"
"`with`' statement from Python 2.5, you can skip this section."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:261
msgid ""
"The ':keyword:`with`' statement is a control-flow structure whose basic "
"structure is::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:267
msgid ""
"The expression is evaluated, and it should result in an object that supports "
"the context management protocol (that is, has :meth:`__enter__` and :meth:"
"`__exit__` methods)."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:308
msgid ""
"The :func:`localcontext` function in the :mod:`decimal` module makes it easy "
"to save and restore the current decimal context, which encapsulates the "
"desired precision and rounding characteristics for computations::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:341
msgid ""
"The context manager's :meth:`__enter__` method is called. The value "
"returned is assigned to *VAR*. If no ``as VAR`` clause is present, the "
"value is simply discarded."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:347
msgid ""
"If *BLOCK* raises an exception, the context manager's :meth:`__exit__` "
"method is called with three arguments, the exception details (``type, value, "
"traceback``, the same values returned by :func:`sys.exc_info`, which can "
"also be ``None`` if no exception occurred). The method's return value "
"controls whether an exception is re-raised: any false value re-raises the "
"exception, and ``True`` will result in suppressing it. You'll only rarely "
"want to suppress the exception, because if you do the author of the code "
"containing the ':keyword:`with`' statement will never realize anything went "
"wrong."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:429
msgid ""
"The :mod:`contextlib` module provides some functions and a decorator that "
"are useful when writing objects for use with the ':keyword:`with`' statement."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:441
msgid ""
"Using this decorator, our database example from the previous section could "
"be written as::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:461
msgid ""
"The :mod:`contextlib` module also has a ``nested(mgr1, mgr2, ...)`` function "
"that combines a number of context managers so you don't need to write nested "
"':keyword:`with`' statements. In this example, the single ':keyword:`with`' "
"statement both starts a database transaction and acquires a thread lock::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:470
msgid ""
"Finally, the :func:`closing` function returns its argument so that it can be "
"bound to a variable, and calls the argument's ``.close()`` method at the end "
"of the block. ::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:497
msgid "PEP 366: Explicit Relative Imports From a Main Module"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:499
msgid ""
"Python's :option:`-m` switch allows running a module as a script. When you "
"ran a module that was located inside a package, relative imports didn't work "
"correctly."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:503
msgid ""
"The fix for Python 2.6 adds a :attr:`__package__` attribute to modules. "
"When this attribute is present, relative imports will be relative to the "
"value of this attribute instead of the :attr:`__name__` attribute."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:508
msgid ""
"PEP 302-style importers can then set :attr:`__package__` as necessary. The :"
"mod:`runpy` module that implements the :option:`-m` switch now does this, so "
"relative imports will now work correctly in scripts running from inside a "
"package."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:518
msgid "PEP 370: Per-user ``site-packages`` Directory"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:520
msgid ""
"When you run Python, the module search path ``sys.path`` usually includes a "
"directory whose path ends in ``\"site-packages\"``. This directory is "
"intended to hold locally-installed packages available to all users using a "
"machine or a particular site installation."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:525
msgid ""
"Python 2.6 introduces a convention for user-specific site directories. The "
"directory varies depending on the platform:"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:528
msgid "Unix and Mac OS X: :file:`~/.local/`"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:529
msgid "Windows: :file:`%APPDATA%/Python`"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:531
msgid ""
"Within this directory, there will be version-specific subdirectories, such "
"as :file:`lib/python2.6/site-packages` on Unix/Mac OS and :file:`Python26/"
"site-packages` on Windows."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:535
msgid ""
"If you don't like the default directory, it can be overridden by an "
"environment variable. :envvar:`PYTHONUSERBASE` sets the root directory used "
"for all Python versions supporting this feature. On Windows, the directory "
"for application-specific data can be changed by setting the :envvar:"
"`APPDATA` environment variable. You can also modify the :file:`site.py` "
"file for your Python installation."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:542
msgid ""
"The feature can be disabled entirely by running Python with the :option:`-s` "
"option or setting the :envvar:`PYTHONNOUSERSITE` environment variable."
msgstr ""
# 6227bdbf32ad47d8abca9cded5ad5789
#: ../src/Doc/whatsnew/2.6.rst:547
msgid ":pep:`370` - Per-user ``site-packages`` Directory"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:549
msgid "PEP written and implemented by Christian Heimes."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:557
msgid "PEP 371: The ``multiprocessing`` Package"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:559
msgid ""
"The new :mod:`multiprocessing` package lets Python programs create new "
"processes that will perform a computation and return a result to the "
"parent. The parent and child processes can communicate using queues and "
"pipes, synchronize their operations using locks and semaphores, and can "
"share simple arrays of data."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:565
msgid ""
"The :mod:`multiprocessing` module started out as an exact emulation of the :"
"mod:`threading` module using processes instead of threads. That goal was "
"discarded along the path to Python 2.6, but the general approach of the "
"module is still similar. The fundamental class is the :class:`Process`, "
"which is passed a callable object and a collection of arguments. The :meth:"
"`start` method sets the callable running in a subprocess, after which you "
"can call the :meth:`is_alive` method to check whether the subprocess is "
"still running and the :meth:`join` method to wait for the process to exit."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:575
msgid ""
"Here's a simple example where the subprocess will calculate a factorial. "
"The function doing the calculation is written strangely so that it takes "
"significantly longer when the input argument is a multiple of 4."
msgstr ""
# f7f62ecdf6154fd198b1a3c30e59c924
#: ../src/Doc/whatsnew/2.6.rst:612
msgid ""
"A :class:`Queue` is used to communicate the result of the factorial. The :"
"class:`Queue` object is stored in a global variable. The child process will "
"use the value of the variable when the child was created; because it's a :"
"class:`Queue`, parent and child can use the object to communicate. (If the "
"parent were to change the value of the global variable, the child's value "
"would be unaffected, and vice versa.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:620
msgid ""
"Two other classes, :class:`Pool` and :class:`Manager`, provide higher-level "
"interfaces. :class:`Pool` will create a fixed number of worker processes, "
"and requests can then be distributed to the workers by calling :meth:`apply` "
"or :meth:`apply_async` to add a single request, and :meth:`map` or :meth:"
"`map_async` to add a number of requests. The following code uses a :class:"
"`Pool` to spread requests across 5 worker processes and retrieve a list of "
"results::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:647
msgid ""
"The other high-level interface, the :class:`Manager` class, creates a "
"separate server process that can hold master copies of Python data "
"structures. Other processes can then access and modify these data "
"structures using proxy objects. The following example creates a shared "
"dictionary by calling the :meth:`dict` method; the worker processes then "
"insert values into the dictionary. (Locking is not done for you "
"automatically, which doesn't matter in this example. :class:`Manager`'s "
"methods also include :meth:`Lock`, :meth:`RLock`, and :meth:`Semaphore` to "
"create shared locks.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:691
msgid "This will produce the output::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:702
msgid "The documentation for the :mod:`multiprocessing` module."
msgstr ""
# 54dc6f0236254da5a723129f240b3978
#: ../src/Doc/whatsnew/2.6.rst:704
msgid ":pep:`371` - Addition of the multiprocessing package"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:705
msgid ""
"PEP written by Jesse Noller and Richard Oudkerk; implemented by Richard "
"Oudkerk and Jesse Noller."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:714
msgid "PEP 3101: Advanced String Formatting"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:716
msgid ""
"In Python 3.0, the `%` operator is supplemented by a more powerful string "
"formatting method, :meth:`format`. Support for the :meth:`str.format` "
"method has been backported to Python 2.6."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:720
msgid ""
"In 2.6, both 8-bit and Unicode strings have a `.format()` method that treats "
"the string as a template and takes the arguments to be formatted. The "
"formatting template uses curly brackets (`{`, `}`) as special characters::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:733
msgid "Curly brackets can be escaped by doubling them::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:738
msgid ""
"Field names can be integers indicating positional arguments, such as ``{0}"
"``, ``{1}``, etc. or names of keyword arguments. You can also supply "
"compound field names that read attributes or access dictionary keys::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:752
msgid ""
"Note that when using dictionary-style notation such as ``[.mp4]``, you don't "
"need to put any quotation marks around the string; it will look up the value "
"using ``.mp4`` as the key. Strings beginning with a number will be "
"converted to an integer. You can't write more complicated expressions "
"inside a format string."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:758
msgid ""
"So far we've shown how to specify which field to substitute into the "
"resulting string. The precise formatting used is also controllable by "
"adding a colon followed by a format specifier. For example::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:772
msgid "Format specifiers can reference other fields through nesting::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:782
msgid "The alignment of a field within the desired width can be specified:"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:785
msgid "Character"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:785
msgid "Effect"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:787
msgid "< (default)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:787
msgid "Left-align"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:788
msgid ">"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:788
msgid "Right-align"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:789
msgid "^"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:789
msgid "Center"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:790
msgid "="
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:790
msgid "(For numeric types only) Pad after the sign."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:793
msgid ""
"Format specifiers can also include a presentation type, which controls how "
"the value is formatted. For example, floating-point numbers can be "
"formatted as a general number or in exponential notation::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:802
msgid ""
"A variety of presentation types are available. Consult the 2.6 "
"documentation for a :ref:`complete list <formatstrings>`; here's a sample:"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:806
msgid "``b``"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:806
msgid "Binary. Outputs the number in base 2."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:807
msgid "``c``"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:807
msgid ""
"Character. Converts the integer to the corresponding Unicode character "
"before printing."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:809
msgid "``d``"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:809
msgid "Decimal Integer. Outputs the number in base 10."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:810
msgid "``o``"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:810
msgid "Octal format. Outputs the number in base 8."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:811
msgid "``x``"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:811
msgid ""
"Hex format. Outputs the number in base 16, using lower-case letters for the "
"digits above 9."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:813
msgid "``e``"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:813
msgid ""
"Exponent notation. Prints the number in scientific notation using the letter "
"'e' to indicate the exponent."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:815
msgid "``g``"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:815
msgid ""
"General format. This prints the number as a fixed-point number, unless the "
"number is too large, in which case it switches to 'e' exponent notation."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:818
msgid "``n``"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:818
msgid ""
"Number. This is the same as 'g' (for floats) or 'd' (for integers), except "
"that it uses the current locale setting to insert the appropriate number "
"separator characters."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:821
msgid "``%``"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:821
msgid ""
"Percentage. Multiplies the number by 100 and displays in fixed ('f') format, "
"followed by a percent sign."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:825
msgid ""
"Classes and types can define a :meth:`__format__` method to control how "
"they're formatted. It receives a single argument, the format specifier::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:834
msgid ""
"There's also a :func:`format` builtin that will format a single value. It "
"calls the type's :meth:`__format__` method with the provided specifier::"
msgstr ""
# 806885e619f3491eac6432870993fd2a
#: ../src/Doc/whatsnew/2.6.rst:844
msgid ":ref:`formatstrings`"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:845
msgid "The reference documentation for format fields."
msgstr ""
# b88646abfbd043298a0fc75430a1edf9
#: ../src/Doc/whatsnew/2.6.rst:846
msgid ":pep:`3101` - Advanced String Formatting"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:848
msgid "PEP written by Talin. Implemented by Eric Smith."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:855
msgid "PEP 3105: ``print`` As a Function"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:857
msgid ""
"The ``print`` statement becomes the :func:`print` function in Python 3.0. "
"Making :func:`print` a function makes it possible to replace the function by "
"doing ``def print(...)`` or importing a new function from somewhere else."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:861
msgid ""
"Python 2.6 has a ``__future__`` import that removes ``print`` as language "
"syntax, letting you use the functional form instead. For example::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:867
msgid "The signature of the new function is::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:872
msgid "The parameters are:"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:874
msgid "*args*: positional arguments whose values will be printed out."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:875
msgid "*sep*: the separator, which will be printed between arguments."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:876
msgid ""
"*end*: the ending text, which will be printed after all of the arguments "
"have been output."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:878
msgid "*file*: the file object to which the output will be sent."
msgstr ""
# 73d1840370b041fa9a4e57ad321e7042
#: ../src/Doc/whatsnew/2.6.rst:881
msgid ":pep:`3105` - Make print a function"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:883
msgid "PEP written by Georg Brandl."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:890
msgid "PEP 3110: Exception-Handling Changes"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:892
msgid ""
"One error that Python programmers occasionally make is writing the following "
"code::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:900
msgid ""
"The author is probably trying to catch both :exc:`TypeError` and :exc:"
"`ValueError` exceptions, but this code actually does something different: it "
"will catch :exc:`TypeError` and bind the resulting exception object to the "
"local name ``\"ValueError\"``. The :exc:`ValueError` exception will not be "
"caught at all. The correct code specifies a tuple of exceptions::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:912
msgid ""
"This error happens because the use of the comma here is ambiguous: does it "
"indicate two different nodes in the parse tree, or a single node that's a "
"tuple?"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:916
msgid ""
"Python 3.0 makes this unambiguous by replacing the comma with the word \"as"
"\". To catch an exception and store the exception object in the variable "
"``exc``, you must write::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:925
msgid ""
"Python 3.0 will only support the use of \"as\", and therefore interprets the "
"first example as catching two different exceptions. Python 2.6 supports "
"both the comma and \"as\", so existing code will continue to work. We "
"therefore suggest using \"as\" when writing new Python code that will only "
"be executed with 2.6."
msgstr ""
# 451316b09876443d9ee9f74ee2ecc086
#: ../src/Doc/whatsnew/2.6.rst:932
msgid ":pep:`3110` - Catching Exceptions in Python 3000"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:934
msgid "PEP written and implemented by Collin Winter."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:941
msgid "PEP 3112: Byte Literals"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:943
msgid ""
"Python 3.0 adopts Unicode as the language's fundamental string type and "
"denotes 8-bit literals differently, either as ``b'string'`` or using a :"
"class:`bytes` constructor. For future compatibility, Python 2.6 adds :class:"
"`bytes` as a synonym for the :class:`str` type, and it also supports the "
"``b''`` notation."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:950
msgid ""
"The 2.6 :class:`str` differs from 3.0's :class:`bytes` type in various ways; "
"most notably, the constructor is completely different. In 3.0, ``bytes([65, "
"66, 67])`` is 3 elements long, containing the bytes representing ``ABC``; in "
"2.6, ``bytes([65, 66, 67])`` returns the 12-byte string representing the :"
"func:`str` of the list."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:956
msgid ""
"The primary use of :class:`bytes` in 2.6 will be to write tests of object "
"type such as ``isinstance(x, bytes)``. This will help the 2to3 converter, "
"which can't tell whether 2.x code intends strings to contain either "
"characters or 8-bit bytes; you can now use either :class:`bytes` or :class:"
"`str` to represent your intention exactly, and the resulting code will also "
"be correct in Python 3.0."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:963
msgid ""
"There's also a ``__future__`` import that causes all string literals to "
"become Unicode strings. This means that ``\\u`` escape sequences can be "
"used to include Unicode characters::"
msgstr ""
# 20105baec2394d19b09f76742fc3fd3f
#: ../src/Doc/whatsnew/2.6.rst:975
msgid ""
"At the C level, Python 3.0 will rename the existing 8-bit string type, "
"called :c:type:`PyStringObject` in Python 2.x, to :c:type:`PyBytesObject`. "
"Python 2.6 uses ``#define`` to support using the names :c:func:"
"`PyBytesObject`, :c:func:`PyBytes_Check`, :c:func:"
"`PyBytes_FromStringAndSize`, and all the other functions and macros used "
"with strings."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:982
msgid ""
"Instances of the :class:`bytes` type are immutable just as strings are. A "
"new :class:`bytearray` type stores a mutable sequence of bytes::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:997
msgid ""
"Byte arrays support most of the methods of string types, such as :meth:"
"`startswith`/:meth:`endswith`, :meth:`find`/:meth:`rfind`, and some of the "
"methods of lists, such as :meth:`append`, :meth:`pop`, and :meth:`reverse`."
msgstr ""
# f54b18ea8c6b4acfb00f8f4472e79ce0
#: ../src/Doc/whatsnew/2.6.rst:1010
msgid ""
"There's also a corresponding C API, with :c:func:`PyByteArray_FromObject`, :"
"c:func:`PyByteArray_FromStringAndSize`, and various other functions."
msgstr ""
# 618beab47a0a42d0a4ed548ed0c6a600
#: ../src/Doc/whatsnew/2.6.rst:1016
msgid ":pep:`3112` - Bytes literals in Python 3000"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1018
msgid "PEP written by Jason Orendorff; backported to 2.6 by Christian Heimes."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1025
msgid "PEP 3116: New I/O Library"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1027
msgid ""
"Python's built-in file objects support a number of methods, but file-like "
"objects don't necessarily support all of them. Objects that imitate files "
"usually support :meth:`read` and :meth:`write`, but they may not support :"
"meth:`readline`, for example. Python 3.0 introduces a layered I/O library "
"in the :mod:`io` module that separates buffering and text-handling features "
"from the fundamental read and write operations."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1035
msgid ""
"There are three levels of abstract base classes provided by the :mod:`io` "
"module:"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1038
msgid ""
":class:`RawIOBase` defines raw I/O operations: :meth:`read`, :meth:"
"`readinto`, :meth:`write`, :meth:`seek`, :meth:`tell`, :meth:`truncate`, "
"and :meth:`close`. Most of the methods of this class will often map to a "
"single system call. There are also :meth:`readable`, :meth:`writable`, and :"
"meth:`seekable` methods for determining what operations a given object will "
"allow."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1046
msgid ""
"Python 3.0 has concrete implementations of this class for files and sockets, "
"but Python 2.6 hasn't restructured its file and socket objects in this way."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1052
msgid ""
":class:`BufferedIOBase` is an abstract base class that buffers data in "
"memory to reduce the number of system calls used, making I/O processing more "
"efficient. It supports all of the methods of :class:`RawIOBase`, and adds a :"
"attr:`raw` attribute holding the underlying raw object."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1058
msgid ""
"There are five concrete classes implementing this ABC. :class:"
"`BufferedWriter` and :class:`BufferedReader` are for objects that support "
"write-only or read-only usage that have a :meth:`seek` method for random "
"access. :class:`BufferedRandom` objects support read and write access upon "
"the same underlying stream, and :class:`BufferedRWPair` is for objects such "
"as TTYs that have both read and write operations acting upon unconnected "
"streams of data. The :class:`BytesIO` class supports reading, writing, and "
"seeking over an in-memory buffer."
msgstr ""
# 6ca5d9cd157042728d0ec3808d195ffd
#: ../src/Doc/whatsnew/2.6.rst:1071
msgid ""
":class:`TextIOBase`: Provides functions for reading and writing strings "
"(remember, strings will be Unicode in Python 3.0), and supporting :term:"
"`universal newlines`. :class:`TextIOBase` defines the :meth:`readline` "
"method and supports iteration upon objects."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1077
msgid ""
"There are two concrete implementations. :class:`TextIOWrapper` wraps a "
"buffered I/O object, supporting all of the methods for text I/O and adding "
"a :attr:`buffer` attribute for access to the underlying object. :class:"
"`StringIO` simply buffers everything in memory without ever writing anything "
"to disk."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1083
msgid ""
"(In Python 2.6, :class:`io.StringIO` is implemented in pure Python, so it's "
"pretty slow. You should therefore stick with the existing :mod:`StringIO` "
"module or :mod:`cStringIO` for now. At some point Python 3.0's :mod:`io` "
"module will be rewritten into C for speed, and perhaps the C implementation "
"will be backported to the 2.x releases.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1089
msgid ""
"In Python 2.6, the underlying implementations haven't been restructured to "
"build on top of the :mod:`io` module's classes. The module is being "
"provided to make it easier to write code that's forward-compatible with 3.0, "
"and to save developers the effort of writing their own implementations of "
"buffering and text I/O."
msgstr ""
# f083df6fb6914c19bee80d67e631dca7
#: ../src/Doc/whatsnew/2.6.rst:1098
msgid ":pep:`3116` - New I/O"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1098
msgid ""
"PEP written by Daniel Stutzbach, Mike Verdone, and Guido van Rossum. Code by "
"Guido van Rossum, Georg Brandl, Walter Doerwald, Jeremy Hylton, Martin von "
"Loewis, Tony Lownds, and others."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1107
msgid "PEP 3118: Revised Buffer Protocol"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1109
msgid ""
"The buffer protocol is a C-level API that lets Python types exchange "
"pointers into their internal representations. A memory-mapped file can be "
"viewed as a buffer of characters, for example, and this lets another module "
"such as :mod:`re` treat memory-mapped files as a string of characters to be "
"searched."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1115
msgid ""
"The primary users of the buffer protocol are numeric-processing packages "
"such as NumPy, which expose the internal representation of arrays so that "
"callers can write data directly into an array instead of going through a "
"slower API. This PEP updates the buffer protocol in light of experience "
"from NumPy development, adding a number of new features such as indicating "
"the shape of an array or locking a memory region."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1122
msgid ""
"The most important new C API function is ``PyObject_GetBuffer(PyObject *obj, "
"Py_buffer *view, int flags)``, which takes an object and a set of flags, and "
"fills in the ``Py_buffer`` structure with information about the object's "
"memory representation. Objects can use this operation to lock memory in "
"place while an external caller could be modifying the contents, so there's a "
"corresponding ``PyBuffer_Release(Py_buffer *view)`` to indicate that the "
"external caller is done."
msgstr ""
# 588a2e47fdec43279632deced0efde1a
#: ../src/Doc/whatsnew/2.6.rst:1134
msgid ""
"The *flags* argument to :c:func:`PyObject_GetBuffer` specifies constraints "
"upon the memory returned. Some examples are:"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1137
msgid ":const:`PyBUF_WRITABLE` indicates that the memory must be writable."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1139
msgid ""
":const:`PyBUF_LOCK` requests a read-only or exclusive lock on the memory."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1141
msgid ""
":const:`PyBUF_C_CONTIGUOUS` and :const:`PyBUF_F_CONTIGUOUS` requests a C-"
"contiguous (last dimension varies the fastest) or Fortran-contiguous (first "
"dimension varies the fastest) array layout."
msgstr ""
# 0a0a5a2e9f114b4a939fa41bb01b8769
#: ../src/Doc/whatsnew/2.6.rst:1145
msgid ""
"Two new argument codes for :c:func:`PyArg_ParseTuple`, ``s*`` and ``z*``, "
"return locked buffer objects for a parameter."
msgstr ""
# 6396f87545d4407cbf745bdfb1af0ab5
#: ../src/Doc/whatsnew/2.6.rst:1150
msgid ":pep:`3118` - Revising the buffer protocol"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1151
msgid ""
"PEP written by Travis Oliphant and Carl Banks; implemented by Travis "
"Oliphant."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1160
msgid "PEP 3119: Abstract Base Classes"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1162
msgid ""
"Some object-oriented languages such as Java support interfaces, declaring "
"that a class has a given set of methods or supports a given access "
"protocol. Abstract Base Classes (or ABCs) are an equivalent feature for "
"Python. The ABC support consists of an :mod:`abc` module containing a "
"metaclass called :class:`ABCMeta`, special handling of this metaclass by "
"the :func:`isinstance` and :func:`issubclass` builtins, and a collection of "
"basic ABCs that the Python developers think will be widely useful. Future "
"versions of Python will probably add more ABCs."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1172
msgid ""
"Let's say you have a particular class and wish to know whether it supports "
"dictionary-style access. The phrase \"dictionary-style\" is vague, however. "
"It probably means that accessing items with ``obj[1]`` works. Does it imply "
"that setting items with ``obj[2] = value`` works? Or that the object will "
"have :meth:`keys`, :meth:`values`, and :meth:`items` methods? What about "
"the iterative variants such as :meth:`iterkeys`? :meth:`copy` and :meth:"
"`update`? Iterating over the object with :func:`iter`?"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1180
msgid ""
"The Python 2.6 :mod:`collections` module includes a number of different ABCs "
"that represent these distinctions. :class:`Iterable` indicates that a class "
"defines :meth:`__iter__`, and :class:`Container` means the class defines a :"
"meth:`__contains__` method and therefore supports ``x in y`` expressions. "
"The basic dictionary interface of getting items, setting items, and :meth:"
"`keys`, :meth:`values`, and :meth:`items`, is defined by the :class:"
"`MutableMapping` ABC."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1189
msgid ""
"You can derive your own classes from a particular ABC to indicate they "
"support that ABC's interface::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1198
msgid ""
"Alternatively, you could write the class without deriving from the desired "
"ABC and instead register the class by calling the ABC's :meth:`register` "
"method::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1209
msgid ""
"For classes that you write, deriving from the ABC is probably clearer. The :"
"meth:`register` method is useful when you've written a new ABC that can "
"describe an existing type or class, or if you want to declare that some "
"third-party class implements an ABC. For example, if you defined a :class:"
"`PrintableType` ABC, it's legal to do::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1221
msgid ""
"Classes should obey the semantics specified by an ABC, but Python can't "
"check this; it's up to the class author to understand the ABC's requirements "
"and to implement the code accordingly."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1225
msgid ""
"To check whether an object supports a particular interface, you can now "
"write::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1232
msgid ""
"Don't feel that you must now begin writing lots of checks as in the above "
"example. Python has a strong tradition of duck-typing, where explicit type-"
"checking is never done and code simply calls methods on an object, trusting "
"that those methods will be there and raising an exception if they aren't. "
"Be judicious in checking for ABCs and only do it where it's absolutely "
"necessary."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1239
msgid ""
"You can write your own ABCs by using ``abc.ABCMeta`` as the metaclass in a "
"class definition::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1260
msgid ""
"In the :class:`Drawable` ABC above, the :meth:`draw_doubled` method renders "
"the object at twice its size and can be implemented in terms of other "
"methods described in :class:`Drawable`. Classes implementing this ABC "
"therefore don't need to provide their own implementation of :meth:"
"`draw_doubled`, though they can do so. An implementation of :meth:`draw` is "
"necessary, though; the ABC can't provide a useful generic implementation."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1268
msgid ""
"You can apply the ``@abstractmethod`` decorator to methods such as :meth:"
"`draw` that must be implemented; Python will then raise an exception for "
"classes that don't define the method. Note that the exception is only raised "
"when you actually try to create an instance of a subclass lacking the "
"method::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1283
msgid ""
"Abstract data attributes can be declared using the ``@abstractproperty`` "
"decorator::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1293
msgid "Subclasses must then define a :meth:`readonly` property."
msgstr ""
# 66e36f0ccbbe42528e6619d58b3a71ab
#: ../src/Doc/whatsnew/2.6.rst:1298
msgid ":pep:`3119` - Introducing Abstract Base Classes"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1298
msgid ""
"PEP written by Guido van Rossum and Talin. Implemented by Guido van Rossum. "
"Backported to 2.6 by Benjamin Aranguren, with Alex Martelli."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1307
msgid "PEP 3127: Integer Literal Support and Syntax"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1309
msgid ""
"Python 3.0 changes the syntax for octal (base-8) integer literals, prefixing "
"them with \"0o\" or \"0O\" instead of a leading zero, and adds support for "
"binary (base-2) integer literals, signalled by a \"0b\" or \"0B\" prefix."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1314
msgid ""
"Python 2.6 doesn't drop support for a leading 0 signalling an octal number, "
"but it does add support for \"0o\" and \"0b\"::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1322
msgid ""
"The :func:`oct` builtin still returns numbers prefixed with a leading zero, "
"and a new :func:`bin` builtin returns the binary representation for a "
"number::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1333
msgid ""
"The :func:`int` and :func:`long` builtins will now accept the \"0o\" and \"0b"
"\" prefixes when base-8 or base-2 are requested, or when the *base* argument "
"is zero (signalling that the base used should be determined from the "
"string)::"
msgstr ""
# 7c5bfcf3e1cf47129830156f9830d481
#: ../src/Doc/whatsnew/2.6.rst:1350
msgid ":pep:`3127` - Integer Literal Support and Syntax"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1351
msgid "PEP written by Patrick Maupin; backported to 2.6 by Eric Smith."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1359
msgid "PEP 3129: Class Decorators"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1361
msgid ""
"Decorators have been extended from functions to classes. It's now legal to "
"write::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1369
msgid "This is equivalent to::"
msgstr ""
# 19fd510ca7f0495592e375291f4dec94
#: ../src/Doc/whatsnew/2.6.rst:1377
msgid ":pep:`3129` - Class Decorators"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1379
msgid "PEP written by Collin Winter."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1386
msgid "PEP 3141: A Type Hierarchy for Numbers"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1388
msgid ""
"Python 3.0 adds several abstract base classes for numeric types inspired by "
"Scheme's numeric tower. These classes were backported to 2.6 as the :mod:"
"`numbers` module."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1392
msgid ""
"The most general ABC is :class:`Number`. It defines no operations at all, "
"and only exists to allow checking if an object is a number by doing "
"``isinstance(obj, Number)``."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1396
msgid ""
":class:`Complex` is a subclass of :class:`Number`. Complex numbers can "
"undergo the basic operations of addition, subtraction, multiplication, "
"division, and exponentiation, and you can retrieve the real and imaginary "
"parts and obtain a number's conjugate. Python's built-in complex type is an "
"implementation of :class:`Complex`."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1402
msgid ""
":class:`Real` further derives from :class:`Complex`, and adds operations "
"that only work on real numbers: :func:`floor`, :func:`trunc`, rounding, "
"taking the remainder mod N, floor division, and comparisons."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1407
msgid ""
":class:`Rational` numbers derive from :class:`Real`, have :attr:`numerator` "
"and :attr:`denominator` properties, and can be converted to floats. Python "
"2.6 adds a simple rational-number class, :class:`Fraction`, in the :mod:"
"`fractions` module. (It's called :class:`Fraction` instead of :class:"
"`Rational` to avoid a name clash with :class:`numbers.Rational`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1414
msgid ""
":class:`Integral` numbers derive from :class:`Rational`, and can be shifted "
"left and right with ``<<`` and ``>>``, combined using bitwise operations "
"such as ``&`` and ``|``, and can be used as array indexes and slice "
"boundaries."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1419
msgid ""
"In Python 3.0, the PEP slightly redefines the existing builtins :func:"
"`round`, :func:`math.floor`, :func:`math.ceil`, and adds a new one, :func:"
"`math.trunc`, that's been backported to Python 2.6. :func:`math.trunc` "
"rounds toward zero, returning the closest :class:`Integral` that's between "
"the function's argument and zero."
msgstr ""
# f73074f903ad43d5b4518650b650e062
#: ../src/Doc/whatsnew/2.6.rst:1427
msgid ":pep:`3141` - A Type Hierarchy for Numbers"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1428
msgid "PEP written by Jeffrey Yasskin."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1430
msgid ""
"`Scheme's numerical tower <http://www.gnu.org/software/guile/manual/"
"html_node/Numerical-Tower.html#Numerical-Tower>`__, from the Guile manual."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1432
msgid ""
"`Scheme's number datatypes <http://schemers.org/Documents/Standards/R5RS/"
"HTML/r5rs-Z-H-9.html#%_sec_6.2>`__ from the R5RS Scheme specification."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1436
msgid "The :mod:`fractions` Module"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1438
msgid ""
"To fill out the hierarchy of numeric types, the :mod:`fractions` module "
"provides a rational-number class. Rational numbers store their values as a "
"numerator and denominator forming a fraction, and can exactly represent "
"numbers such as ``2/3`` that floating-point numbers can only approximate."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1444
msgid ""
"The :class:`Fraction` constructor takes two :class:`Integral` values that "
"will be the numerator and denominator of the resulting fraction. ::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1457
msgid ""
"For converting floating-point numbers to rationals, the float type now has "
"an :meth:`as_integer_ratio()` method that returns the numerator and "
"denominator for a fraction that evaluates to the same floating-point value::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1469
msgid ""
"Note that values that can only be approximated by floating-point numbers, "
"such as 1./3, are not simplified to the number being approximated; the "
"fraction attempts to match the floating-point value **exactly**."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1474
msgid ""
"The :mod:`fractions` module is based upon an implementation by Sjoerd "
"Mullender that was in Python's :file:`Demo/classes/` directory for a long "
"time. This implementation was significantly updated by Jeffrey Yasskin."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1483 ../src/Doc/whatsnew/2.7.rst:665
msgid "Some smaller changes made to the core Python language are:"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1485
msgid ""
"Directories and zip archives containing a :file:`__main__.py` file can now "
"be executed directly by passing their name to the interpreter. The directory "
"or zip archive is automatically inserted as the first entry in sys.path. "
"(Suggestion and initial patch by Andy Chu, subsequently revised by Phillip "
"J. Eby and Nick Coghlan; :issue:`1739468`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1492
msgid ""
"The :func:`hasattr` function was catching and ignoring all errors, under the "
"assumption that they meant a :meth:`__getattr__` method was failing somehow "
"and the return value of :func:`hasattr` would therefore be ``False``. This "
"logic shouldn't be applied to :exc:`KeyboardInterrupt` and :exc:"
"`SystemExit`, however; Python 2.6 will no longer discard such exceptions "
"when :func:`hasattr` encounters them. (Fixed by Benjamin Peterson; :issue:"
"`2196`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1500
msgid ""
"When calling a function using the ``**`` syntax to provide keyword "
"arguments, you are no longer required to use a Python dictionary; any "
"mapping will now work::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1513
msgid "(Contributed by Alexander Belopolsky; :issue:`1686487`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1515
msgid ""
"It's also become legal to provide keyword arguments after a ``*args`` "
"argument to a function call. ::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1524
msgid ""
"Previously this would have been a syntax error. (Contributed by Amaury "
"Forgeot d'Arc; :issue:`3473`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1527
msgid ""
"A new builtin, ``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, the :exc:"
"`StopIteration` exception will be raised. (Backported in :issue:`2719`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1533
msgid ""
"Tuples now have :meth:`index` and :meth:`count` methods matching the list "
"type's :meth:`index` and :meth:`count` methods::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1542
msgid "(Contributed by Raymond Hettinger)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1544
msgid ""
"The built-in types now have improved support for extended slicing syntax, "
"accepting various combinations of ``(start, stop, step)``. Previously, the "
"support was partial and certain corner cases wouldn't work. (Implemented by "
"Thomas Wouters.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1551
msgid ""
"Properties now have three attributes, :attr:`getter`, :attr:`setter` and :"
"attr:`deleter`, that are decorators providing useful shortcuts for adding a "
"getter, setter or deleter function to an existing property. You would use "
"them like this::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1578
msgid ""
"Several methods of the built-in set types now accept multiple iterables: :"
"meth:`intersection`, :meth:`intersection_update`, :meth:`union`, :meth:"
"`update`, :meth:`difference` and :meth:`difference_update`."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1594
msgid ""
"Many floating-point features were added. The :func:`float` function will "
"now turn the string ``nan`` into an IEEE 754 Not A Number value, and ``"
"+inf`` and ``-inf`` into positive or negative infinity. This works on any "
"platform with IEEE 754 semantics. (Contributed by Christian Heimes; :issue:"
"`1635`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1600
msgid ""
"Other functions in the :mod:`math` module, :func:`isinf` and :func:`isnan`, "
"return true if their floating-point argument is infinite or Not A Number. (:"
"issue:`1640`)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1604
msgid ""
"Conversion functions were added to convert floating-point numbers into "
"hexadecimal strings (:issue:`3008`). These functions convert floats to and "
"from a string representation without introducing rounding errors from the "
"conversion between decimal and binary. Floats have a :meth:`hex` method "
"that returns a string representation, and the ``float.fromhex()`` method "
"converts a string back into a number::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1621
msgid ""
"A numerical nicety: when creating a complex number from two floats on "
"systems that support signed zeros (-0 and +0), the :func:`complex` "
"constructor will now preserve the sign of the zero. (Fixed by Mark T. "
"Dickinson; :issue:`1507`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1626
msgid ""
"Classes that inherit a :meth:`__hash__` method from a parent class can set "
"``__hash__ = None`` to indicate that the class isn't hashable. This will "
"make ``hash(obj)`` raise a :exc:`TypeError` and the class will not be "
"indicated as implementing the :class:`Hashable` ABC."
msgstr ""
# 95d44d20bc4341a892d1200ba5ef0e05
#: ../src/Doc/whatsnew/2.6.rst:1632
msgid ""
"You should do this when you've defined a :meth:`__cmp__` or :meth:`__eq__` "
"method that compares objects by their value rather than by identity. All "
"objects have a default hash method that uses ``id(obj)`` as the hash value. "
"There's no tidy way to remove the :meth:`__hash__` method inherited from a "
"parent class, so assigning ``None`` was implemented as an override. At the "
"C level, extensions can set ``tp_hash`` to :c:func:"
"`PyObject_HashNotImplemented`. (Fixed by Nick Coghlan and Amaury Forgeot "
"d'Arc; :issue:`2235`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1642
msgid ""
"The :exc:`GeneratorExit` exception now subclasses :exc:`BaseException` "
"instead of :exc:`Exception`. This means that an exception handler that does "
"``except Exception:`` will not inadvertently catch :exc:`GeneratorExit`. "
"(Contributed by Chad Austin; :issue:`1537`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1648
msgid ""
"Generator objects now have a :attr:`gi_code` attribute that refers to the "
"original code object backing the generator. (Contributed by Collin Winter; :"
"issue:`1473257`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1652
msgid ""
"The :func:`compile` built-in function now accepts keyword arguments as well "
"as positional parameters. (Contributed by Thomas Wouters; :issue:`1444529`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1656
msgid ""
"The :func:`complex` constructor now accepts strings containing parenthesized "
"complex numbers, meaning that ``complex(repr(cplx))`` will now round-trip "
"values. For example, ``complex('(3+4j)')`` now returns the value (3+4j). (:"
"issue:`1491866`)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1661
msgid ""
"The string :meth:`translate` method now accepts ``None`` as the translation "
"table parameter, which is treated as the identity transformation. This "
"makes it easier to carry out operations that only delete characters. "
"(Contributed by Bengt Richter and implemented by Raymond Hettinger; :issue:"
"`1193128`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1667
msgid ""
"The built-in :func:`dir` function now checks for a :meth:`__dir__` method on "
"the objects it receives. This method must return a list of strings "
"containing the names of valid attributes for the object, and lets the object "
"control the value that :func:`dir` produces. Objects that have :meth:"
"`__getattr__` or :meth:`__getattribute__` methods can use this to advertise "
"pseudo-attributes they will honor. (:issue:`1591665`)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1675
msgid ""
"Instance method objects have new attributes for the object and function "
"comprising the method; the new synonym for :attr:`im_self` is :attr:"
"`__self__`, and :attr:`im_func` is also available as :attr:`__func__`. The "
"old names are still supported in Python 2.6, but are gone in 3.0."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1680
msgid ""
"An obscure change: when you use the :func:`locals` function inside a :"
"keyword:`class` statement, the resulting dictionary no longer returns free "
"variables. (Free variables, in this case, are variables referenced in the :"
"keyword:`class` statement that aren't attributes of the class.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1691
msgid ""
"The :mod:`warnings` module has been rewritten in C. This makes it possible "
"to invoke warnings from the parser, and may also make the interpreter's "
"startup faster. (Contributed by Neal Norwitz and Brett Cannon; :issue:"
"`1631171`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1696
msgid ""
"Type objects now have a cache of methods that can reduce the work required "
"to find the correct method implementation for a particular class; once "
"cached, the interpreter doesn't need to traverse base classes to figure out "
"the right method to call. The cache is cleared if a base class or the class "
"itself is modified, so the cache should remain correct even in the face of "
"Python's dynamic nature. (Original optimization implemented by Armin Rigo, "
"updated for Python 2.6 by Kevin Jacobs; :issue:`1700288`.)"
msgstr ""
# d3925186e2da4ff0b5abe8b00f82d7fd
#: ../src/Doc/whatsnew/2.6.rst:1706
msgid ""
"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 :c:macro:`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.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1717
msgid ""
"Function calls that use keyword arguments are significantly faster by doing "
"a quick pointer comparison, usually saving the time of a full string "
"comparison. (Contributed by Raymond Hettinger, after an initial "
"implementation by Antoine Pitrou; :issue:`1819`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1722
msgid ""
"All of the functions in the :mod:`struct` module have been rewritten in C, "
"thanks to work at the Need For Speed sprint. (Contributed by Raymond "
"Hettinger.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1726
msgid ""
"Some of the standard built-in types now set a bit in their type objects. "
"This speeds up checking whether an object is a subclass of one of these "
"types. (Contributed by Neal Norwitz.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1730
msgid ""
"Unicode strings now use faster code for detecting whitespace and line "
"breaks; this speeds up the :meth:`split` method by about 25% and :meth:"
"`splitlines` by 35%. (Contributed by Antoine Pitrou.) Memory usage is "
"reduced by using pymalloc for the Unicode string's data."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1736
msgid ""
"The ``with`` statement now stores the :meth:`__exit__` method on the stack, "
"producing a small speedup. (Implemented by Jeffrey Yasskin.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1739
msgid ""
"To reduce memory usage, the garbage collector will now clear internal free "
"lists when garbage-collecting the highest generation of objects. This may "
"return memory to the operating system sooner."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1748 ../src/Doc/whatsnew/2.7.rst:892
msgid "Interpreter Changes"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1750
msgid ""
"Two command-line options have been reserved for use by other Python "
"implementations. The :option:`-J` switch has been reserved for use by "
"Jython for Jython-specific options, such as switches that are passed to the "
"underlying JVM. :option:`-X` has been reserved for options specific to a "
"particular implementation of Python such as CPython, Jython, or IronPython. "
"If either option is used with Python 2.6, the interpreter will report that "
"the option isn't currently used."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1758
msgid ""
"Python can now be prevented from writing :file:`.pyc` or :file:`.pyo` files "
"by supplying the :option:`-B` switch to the Python interpreter, or by "
"setting the :envvar:`PYTHONDONTWRITEBYTECODE` environment variable before "
"running the interpreter. This setting is available to Python programs as "
"the ``sys.dont_write_bytecode`` variable, and Python code can change the "
"value to modify the interpreter's behaviour. (Contributed by Neal Norwitz "
"and Georg Brandl.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1766
msgid ""
"The encoding used for standard input, output, and standard error can be "
"specified by setting the :envvar:`PYTHONIOENCODING` environment variable "
"before running the interpreter. The value should be a string in the form "
"``<encoding>`` or ``<encoding>:<errorhandler>``. The *encoding* part "
"specifies the encoding's name, e.g. ``utf-8`` or ``latin-1``; the optional "
"*errorhandler* part specifies what to do with characters that can't be "
"handled by the encoding, and should be one of \"error\", \"ignore\", or "
"\"replace\". (Contributed by Martin von Loewis.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1781 ../src/Doc/whatsnew/2.7.rst:1012
msgid ""
"As in every release, 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 Subversion logs for all the details."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1787
msgid ""
"The :mod:`asyncore` and :mod:`asynchat` modules are being actively "
"maintained again, and a number of patches and bugfixes were applied. "
"(Maintained by Josiah Carlson; see :issue:`1736190` for one patch.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1792
msgid ""
"The :mod:`bsddb` module also has a new maintainer, Jesús Cea Avion, and the "
"package is now available as a standalone package. The web page for the "
"package is `www.jcea.es/programacion/pybsddb.htm <http://www.jcea.es/"
"programacion/pybsddb.htm>`__. The plan is to remove the package from the "
"standard library in Python 3.0, because its pace of releases is much more "
"frequent than Python's."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1800
msgid ""
"The :mod:`bsddb.dbshelve` module now uses the highest pickling protocol "
"available, instead of restricting itself to protocol 1. (Contributed by W. "
"Barnes.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1804
msgid ""
"The :mod:`cgi` module will now read variables from the query string of an "
"HTTP POST request. This makes it possible to use form actions with URLs "
"that include query strings such as \"/cgi-bin/add.py?category=1\". "
"(Contributed by Alexandre Fiori and Nubis; :issue:`1817`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1810
msgid ""
"The :func:`parse_qs` and :func:`parse_qsl` functions have been relocated "
"from the :mod:`cgi` module to the :mod:`urlparse` module. The versions still "
"available in the :mod:`cgi` module will trigger :exc:"
"`PendingDeprecationWarning` messages in 2.6 (:issue:`600362`)."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1816
msgid ""
"The :mod:`cmath` module underwent extensive revision, contributed by Mark "
"Dickinson and Christian Heimes. Five new functions were added:"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1820
msgid ""
":func:`polar` converts a complex number to polar form, returning the modulus "
"and argument of the complex number."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1823
msgid ""
":func:`rect` does the opposite, turning a modulus, argument pair back into "
"the corresponding complex number."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1826
msgid ""
":func:`phase` returns the argument (also called the angle) of a complex "
"number."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1829
msgid ""
":func:`isnan` returns True if either the real or imaginary part of its "
"argument is a NaN."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1832
msgid ""
":func:`isinf` returns True if either the real or imaginary part of its "
"argument is infinite."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1835
msgid ""
"The revisions also improved the numerical soundness of the :mod:`cmath` "
"module. For all functions, the real and imaginary parts of the results are "
"accurate to within a few units of least precision (ulps) whenever possible. "
"See :issue:`1381` for the details. The branch cuts for :func:`asinh`, :func:"
"`atanh`: and :func:`atan` have also been corrected."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1842
msgid ""
"The tests for the module have been greatly expanded; nearly 2000 new test "
"cases exercise the algebraic functions."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1845
msgid ""
"On IEEE 754 platforms, the :mod:`cmath` module now handles IEEE 754 special "
"values and floating-point exceptions in a manner consistent with Annex 'G' "
"of the C99 standard."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1849
msgid ""
"A new data type in the :mod:`collections` module: :class:"
"`namedtuple(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::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1871
msgid ""
"Several places in the standard library that returned tuples have been "
"modified to return :class:`namedtuple` instances. For example, the :meth:"
"`Decimal.as_tuple` method now returns a named tuple with :attr:`sign`, :attr:"
"`digits`, and :attr:`exponent` fields."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1878
msgid ""
"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."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1899
msgid ""
"The :mod:`Cookie` module's :class:`Morsel` objects now support an :attr:"
"`httponly` attribute. In some browsers. cookies with this attribute set "
"cannot be accessed or manipulated by JavaScript code. (Contributed by Arvin "
"Schnell; :issue:`1638033`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1904
msgid ""
"A new window method in the :mod:`curses` module, :meth:`chgat`, changes the "
"display attributes for a certain number of characters on a single line. "
"(Contributed by Fabian Kreutz.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1914
msgid ""
"The :class:`Textbox` class in the :mod:`curses.textpad` module now supports "
"editing in insert mode as well as overwrite mode. Insert mode is enabled by "
"supplying a true value for the *insert_mode* parameter when creating the :"
"class:`Textbox` instance."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1919
msgid ""
"The :mod:`datetime` module's :meth:`strftime` methods now support a ``%f`` "
"format code that expands to the number of microseconds in the object, zero-"
"padded on the left to six places. (Contributed by Skip Montanaro; :issue:"
"`1158`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1924
msgid ""
"The :mod:`decimal` module was updated to version 1.66 of `the General "
"Decimal Specification <http://www2.hursley.ibm.com/decimal/decarith."
"html>`__. New features include some methods for some basic mathematical "
"functions such as :meth:`exp` and :meth:`log10`::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1936
msgid ""
"The :meth:`as_tuple` method of :class:`Decimal` objects now returns a named "
"tuple with :attr:`sign`, :attr:`digits`, and :attr:`exponent` fields."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1939
msgid ""
"(Implemented by Facundo Batista and Mark Dickinson. Named tuple support "
"added by Raymond Hettinger.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1942
msgid ""
"The :mod:`difflib` module's :class:`SequenceMatcher` class now returns named "
"tuples representing matches, with :attr:`a`, :attr:`b`, and :attr:`size` "
"attributes. (Contributed by Raymond Hettinger.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1947
msgid ""
"An optional ``timeout`` parameter, specifying a timeout measured in seconds, "
"was added to the :class:`ftplib.FTP` class constructor as well as the :meth:"
"`connect` method. (Added by Facundo Batista.) Also, the :class:`FTP` "
"class's :meth:`storbinary` and :meth:`storlines` now take an optional "
"*callback* parameter that will be called with each block of data after the "
"data has been sent. (Contributed by Phil Schwartz; :issue:`1221598`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1955
msgid ""
"The :func:`reduce` built-in function is also available in the :mod:"
"`functools` module. In Python 3.0, the builtin has been dropped and :func:"
"`reduce` is only available from :mod:`functools`; currently there are no "
"plans to drop the builtin in the 2.x series. (Patched by Christian Heimes; :"
"issue:`1739906`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1961
msgid ""
"When possible, the :mod:`getpass` module will now use :file:`/dev/tty` to "
"print a prompt message and read the password, falling back to standard error "
"and standard input. If the password may be echoed to the terminal, a "
"warning is printed before the prompt is displayed. (Contributed by Gregory "
"P. Smith.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1967
msgid ""
"The :func:`glob.glob` function can now return Unicode filenames if a Unicode "
"path was used and Unicode filenames are matched within the directory. (:"
"issue:`1001604`)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1971
msgid ""
"A new function in the :mod:`heapq` module, ``merge(iter1, iter2, ...)``, "
"takes any number of iterables returning data in sorted order, and returns a "
"new generator that returns the contents of all the iterators, also in sorted "
"order. For example::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1979
msgid ""
"Another new function, ``heappushpop(heap, item)``, pushes *item* onto "
"*heap*, then pops off and returns the smallest item. This is more efficient "
"than making a call to :func:`heappush` and then :func:`heappop`."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1984
msgid ""
":mod:`heapq` is now implemented to only use less-than comparison, instead of "
"the less-than-or-equal comparison it previously used. This makes :mod:"
"`heapq`'s usage of a type match the :meth:`list.sort` method. (Contributed "
"by Raymond Hettinger.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1990
msgid ""
"An optional ``timeout`` parameter, specifying a timeout measured in seconds, "
"was added to the :class:`httplib.HTTPConnection` and :class:"
"`HTTPSConnection` class constructors. (Added by Facundo Batista.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:1995
msgid ""
"Most of the :mod:`inspect` module's functions, such as :func:`getmoduleinfo` "
"and :func:`getargs`, now return named tuples. In addition to behaving like "
"tuples, the elements of the return value can also be accessed as "
"attributes. (Contributed by Raymond Hettinger.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2001
msgid ""
"Some new functions in the module include :func:`isgenerator`, :func:"
"`isgeneratorfunction`, and :func:`isabstract`."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2005
msgid "The :mod:`itertools` module gained several new functions."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2007
msgid ""
"``izip_longest(iter1, iter2, ...[, fillvalue])`` makes tuples from each of "
"the elements; if some of the iterables are shorter than others, the missing "
"values are set to *fillvalue*. For example::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2014
msgid ""
"``product(iter1, iter2, ..., [repeat=N])`` returns the Cartesian product of "
"the supplied iterables, a set of tuples containing every possible "
"combination of the elements returned from each iterable. ::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2023
msgid ""
"The optional *repeat* keyword argument is used for taking the product of an "
"iterable or a set of iterables with themselves, repeated *N* times. With a "
"single iterable argument, *N*-tuples are returned::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2032
msgid "With two iterables, *2N*-tuples are returned. ::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2040
msgid ""
"``combinations(iterable, r)`` returns sub-sequences of length *r* from the "
"elements of *iterable*. ::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2051
msgid ""
"``permutations(iter[, r])`` returns all the permutations of length *r* of "
"the iterable's elements. If *r* is not specified, it will default to the "
"number of elements produced by the iterable. ::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2061
msgid ""
"``itertools.chain(*iterables)`` is an existing function in :mod:`itertools` "
"that gained a new constructor in Python 2.6. ``itertools.chain."
"from_iterable(iterable)`` takes a single iterable that should return other "
"iterables. :func:`chain` will then return all the elements of the first "
"iterable, then all the elements of the second, and so on. ::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2071
msgid "(All contributed by Raymond Hettinger.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2073
msgid ""
"The :mod:`logging` module's :class:`FileHandler` class and its subclasses :"
"class:`WatchedFileHandler`, :class:`RotatingFileHandler`, and :class:"
"`TimedRotatingFileHandler` now have an optional *delay* parameter to their "
"constructors. If *delay* is true, opening of the log file is deferred until "
"the first :meth:`emit` call is made. (Contributed by Vinay Sajip.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2080
msgid ""
":class:`TimedRotatingFileHandler` also has a *utc* constructor parameter. "
"If the argument is true, UTC time will be used in determining when midnight "
"occurs and in generating filenames; otherwise local time will be used."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2085
msgid "Several new functions were added to the :mod:`math` module:"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2087
msgid ""
":func:`~math.isinf` and :func:`~math.isnan` determine whether a given float "
"is a (positive or negative) infinity or a NaN (Not a Number), respectively."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2090
msgid ""
":func:`~math.copysign` copies the sign bit of an IEEE 754 number, returning "
"the absolute value of *x* combined with the sign bit of *y*. For example, "
"``math.copysign(1, -0.0)`` returns -1.0. (Contributed by Christian Heimes.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2095
msgid ""
":func:`~math.factorial` computes the factorial of a number. (Contributed by "
"Raymond Hettinger; :issue:`2138`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2098
msgid ""
":func:`~math.fsum` adds up the stream of numbers from an iterable, and is "
"careful to avoid loss of precision through using partial sums. (Contributed "
"by Jean Brouwers, Raymond Hettinger, and Mark Dickinson; :issue:`2819`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2103
msgid ""
":func:`~math.acosh`, :func:`~math.asinh` and :func:`~math.atanh` compute the "
"inverse hyperbolic functions."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2106
msgid ":func:`~math.log1p` returns the natural logarithm of *1+x* (base *e*)."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2109
msgid ""
":func:`trunc` rounds a number toward zero, returning the closest :class:"
"`Integral` that's between the function's argument and zero. Added as part of "
"the backport of `PEP 3141's type hierarchy for numbers <#pep-3141>`__."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2114
msgid ""
"The :mod:`math` module has been improved to give more consistent behaviour "
"across platforms, especially with respect to handling of floating-point "
"exceptions and IEEE 754 special values."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2118
msgid ""
"Whenever possible, the module follows the recommendations of the C99 "
"standard about 754's special values. For example, ``sqrt(-1.)`` should now "
"give a :exc:`ValueError` across almost all platforms, while "
"``sqrt(float('NaN'))`` should return a NaN on all IEEE 754 platforms. Where "
"Annex 'F' of the C99 standard recommends signaling 'divide-by-zero' or "
"'invalid', Python will raise :exc:`ValueError`. Where Annex 'F' of the C99 "
"standard recommends signaling 'overflow', Python will raise :exc:"
"`OverflowError`. (See :issue:`711019` and :issue:`1640`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2128
msgid "(Contributed by Christian Heimes and Mark Dickinson.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2130
msgid ""
":class:`mmap` objects now have a :meth:`rfind` method that searches for a "
"substring beginning at the end of the string and searching backwards. The :"
"meth:`find` method also gained an *end* parameter giving an index at which "
"to stop searching. (Contributed by John Lenton.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2136
msgid ""
"The :mod:`operator` module gained a :func:`methodcaller` function that takes "
"a name and an optional set of arguments, returning a callable that will call "
"the named function on any arguments passed to it. For example::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2146
msgid "(Contributed by Georg Brandl, after a suggestion by Gregory Petrosyan.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2148
msgid ""
"The :func:`attrgetter` function now accepts dotted names and performs the "
"corresponding attribute lookups::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2158
msgid "(Contributed by Georg Brandl, after a suggestion by Barry Warsaw.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2160
msgid ""
"The :mod:`os` module now wraps several new system calls. ``fchmod(fd, "
"mode)`` and ``fchown(fd, uid, gid)`` change the mode and ownership of an "
"opened file, and ``lchmod(path, mode)`` changes the mode of a symlink. "
"(Contributed by Georg Brandl and Christian Heimes.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2166
msgid ""
":func:`chflags` and :func:`lchflags` are wrappers for the corresponding "
"system calls (where they're available), changing the flags set on a file. "
"Constants for the flag values are defined in the :mod:`stat` module; some "
"possible values include :const:`UF_IMMUTABLE` to signal the file may not be "
"changed and :const:`UF_APPEND` to indicate that data can only be appended to "
"the file. (Contributed by M. Levinson.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2174
msgid ""
"``os.closerange(low, high)`` efficiently closes all file descriptors from "
"*low* to *high*, ignoring any errors and not including *high* itself. This "
"function is now used by the :mod:`subprocess` module to make starting "
"processes faster. (Contributed by Georg Brandl; :issue:`1663329`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2179
msgid ""
"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 Martin Horcicka; :issue:`1181`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2183
msgid ""
"The :func:`os.walk` function now has a ``followlinks`` parameter. If set to "
"True, it will follow symlinks pointing to directories and visit the "
"directory's contents. For backward compatibility, the parameter's default "
"value is false. Note that the function can fall into an infinite recursion "
"if there's a symlink that points to a parent directory. (:issue:`1273829`)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2190
msgid ""
"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. For example, ``os.path.splitext('.ipython')`` "
"now returns ``('.ipython', '')`` instead of ``('', '.ipython')``. (:issue:"
"`1115886`)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2197
msgid ""
"A new function, ``os.path.relpath(path, start='.')``, returns a relative "
"path from the ``start`` path, if it's supplied, or from the current working "
"directory to the destination ``path``. (Contributed by Richard Barran; :"
"issue:`1339796`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2202
msgid ""
"On Windows, :func:`os.path.expandvars` will now expand environment variables "
"given in the form \"%var%\", and \"~user\" will be expanded into the user's "
"home directory path. (Contributed by Josiah Carlson; :issue:`957650`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2207
msgid ""
"The Python debugger provided by the :mod:`pdb` module gained a new command: "
"\"run\" restarts the Python program being debugged and can optionally take "
"new command-line arguments for the program. (Contributed by Rocky "
"Bernstein; :issue:`1393667`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2212
msgid ""
"The :func:`pdb.post_mortem` function, used to begin debugging a traceback, "
"will now use the traceback returned by :func:`sys.exc_info` if no traceback "
"is supplied. (Contributed by Facundo Batista; :issue:`1106316`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2217
msgid ""
"The :mod:`pickletools` module now has an :func:`optimize` function that "
"takes a string containing a pickle and removes some unused opcodes, "
"returning a shorter pickle that contains the same data structure. "
"(Contributed by Raymond Hettinger.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2222
msgid ""
"A :func:`get_data` function was added to the :mod:`pkgutil` module that "
"returns the contents of resource files included with an installed Python "
"package. For example::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2237
msgid "(Contributed by Paul Moore; :issue:`2439`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2239
msgid ""
"The :mod:`pyexpat` module's :class:`Parser` objects now allow setting their :"
"attr:`buffer_size` attribute to change the size of the buffer used to hold "
"character data. (Contributed by Achim Gaedke; :issue:`1137`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2244
msgid ""
"The :mod:`Queue` module now provides queue variants that retrieve entries in "
"different orders. The :class:`PriorityQueue` class stores queued items in a "
"heap and retrieves them in priority order, and :class:`LifoQueue` retrieves "
"the most recently added entries first, meaning that it behaves like a stack. "
"(Contributed by Raymond Hettinger.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2251
msgid ""
"The :mod:`random` module's :class:`Random` objects can now be pickled on a "
"32-bit system and unpickled on a 64-bit system, and vice versa. "
"Unfortunately, this change also means that Python 2.6's :class:`Random` "
"objects can't be unpickled correctly on earlier versions of Python. "
"(Contributed by Shawn Ligocki; :issue:`1727780`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2258
msgid ""
"The new ``triangular(low, high, mode)`` function returns random numbers "
"following a triangular distribution. The returned values are between *low* "
"and *high*, not including *high* itself, and with *mode* as the most "
"frequently occurring value in the distribution. (Contributed by Wladmir van "
"der Laan and Raymond Hettinger; :issue:`1681432`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2265
msgid ""
"Long regular expression searches carried out by the :mod:`re` module will "
"check for signals being delivered, so time-consuming searches can now be "
"interrupted. (Contributed by Josh Hoyt and Ralf Schmitt; :issue:`846388`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2270
msgid ""
"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`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2277
msgid ""
"The :mod:`rlcompleter` module's :meth:`Completer.complete()` method will now "
"ignore exceptions triggered while evaluating a name. (Fixed by Lorenz "
"Quack; :issue:`2250`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2281
msgid ""
"The :mod:`sched` module's :class:`scheduler` instances now have a read-only :"
"attr:`queue` attribute that returns the contents of the scheduler's queue, "
"represented as a list of named tuples with the fields ``(time, priority, "
"action, argument)``. (Contributed by Raymond Hettinger; :issue:`1861`.)"
msgstr ""
# ebb06c8495b94e83b283eb509808a501
#: ../src/Doc/whatsnew/2.6.rst:2287
msgid ""
"The :mod:`select` module now has wrapper functions for the Linux :c:func:"
"`epoll` and BSD :c:func:`kqueue` system calls. :meth:`modify` method was "
"added to the existing :class:`poll` objects; ``pollobj.modify(fd, "
"eventmask)`` takes a file descriptor or file object and an event mask, "
"modifying the recorded event mask for that file. (Contributed by Christian "
"Heimes; :issue:`1657`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2295
msgid ""
"The :func:`shutil.copytree` function now has an optional *ignore* argument "
"that takes a callable object. This callable will receive each directory "
"path and a list of the directory's contents, and returns a list of names "
"that will be ignored, not copied."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2300
msgid ""
"The :mod:`shutil` module also provides an :func:`ignore_patterns` function "
"for use with this new parameter. :func:`ignore_patterns` takes an arbitrary "
"number of glob-style patterns and returns a callable that will ignore any "
"files and directories that match any of these patterns. The following "
"example copies a directory tree, but skips both :file:`.svn` directories and "
"Emacs backup files, which have names ending with '~'::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2311
msgid "(Contributed by Tarek Ziadé; :issue:`2663`.)"
msgstr ""
# 86357277da31404ba443c4b4225a7733
#: ../src/Doc/whatsnew/2.6.rst:2313
msgid ""
"Integrating signal handling with GUI handling event loops like those used by "
"Tkinter or GTk+ has long been a problem; most software ends up polling, "
"waking up every fraction of a second to check if any GUI events have "
"occurred. The :mod:`signal` module can now make this more efficient. Calling "
"``signal.set_wakeup_fd(fd)`` sets a file descriptor to be used; when a "
"signal is received, a byte is written to that file descriptor. There's also "
"a C-level function, :c:func:`PySignal_SetWakeupFd`, for setting the "
"descriptor."
msgstr ""
# 9b70eaeda526450096bafddc61f4c75d
#: ../src/Doc/whatsnew/2.6.rst:2323
msgid ""
"Event loops will use this by opening a pipe to create two descriptors, one "
"for reading and one for writing. The writable descriptor will be passed to :"
"func:`set_wakeup_fd`, and the readable descriptor will be added to the list "
"of descriptors monitored by the event loop via :c:func:`select` or :c:func:"
"`poll`. On receiving a signal, a byte will be written and the main event "
"loop will be woken up, avoiding the need to poll."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2331
msgid "(Contributed by Adam Olsen; :issue:`1583`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2333
msgid ""
"The :func:`siginterrupt` function is now available from Python code, and "
"allows changing whether signals can interrupt system calls or not. "
"(Contributed by Ralf Schmitt.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2337
msgid ""
"The :func:`setitimer` and :func:`getitimer` functions have also been added "
"(where they're available). :func:`setitimer` allows setting interval timers "
"that will cause a signal to be delivered to the process after a specified "
"time, measured in wall-clock time, consumed process time, or combined process"
"+system time. (Contributed by Guilherme Polo; :issue:`2240`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2344
msgid ""
"The :mod:`smtplib` module now supports SMTP over SSL thanks to the addition "
"of the :class:`SMTP_SSL` class. This class supports an interface identical "
"to the existing :class:`SMTP` class. (Contributed by Monty Taylor.) Both "
"class constructors also have an optional ``timeout`` parameter that "
"specifies a timeout for the initial connection attempt, measured in "
"seconds. (Contributed by Facundo Batista.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2352
msgid ""
"An implementation of the LMTP protocol (:rfc:`2033`) was also added to the "
"module. LMTP is used in place of SMTP when transferring e-mail between "
"agents that don't manage a mail queue. (LMTP implemented by Leif Hedstrom; :"
"issue:`957003`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2357
msgid ""
":meth:`SMTP.starttls` now complies with :rfc:`3207` and forgets any "
"knowledge obtained from the server not obtained from the TLS negotiation "
"itself. (Patch contributed by Bill Fenner; :issue:`829951`.)"
msgstr ""
# 1865ce388a63489fabeedeb71416c2d6
#: ../src/Doc/whatsnew/2.6.rst:2362
msgid ""
"The :mod:`socket` module now supports TIPC (http://tipc.sourceforge.net/), a "
"high-performance non-IP-based protocol designed for use in clustered "
"environments. TIPC addresses are 4- or 5-tuples. (Contributed by Alberto "
"Bertogli; :issue:`1646`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2367
msgid ""
"A new function, :func:`create_connection`, takes an address and connects to "
"it using an optional timeout value, returning the connected socket object. "
"This function also looks up the address's type and connects to it using IPv4 "
"or IPv6 as appropriate. Changing your code to use :func:`create_connection` "
"instead of ``socket(socket.AF_INET, ...)`` may be all that's required to "
"make your code work with IPv6."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2375
msgid ""
"The base classes in the :mod:`SocketServer` module now support calling a :"
"meth:`handle_timeout` method after a span of inactivity specified by the "
"server's :attr:`timeout` attribute. (Contributed by Michael Pomraning.) "
"The :meth:`serve_forever` method now takes an optional poll interval "
"measured in seconds, controlling how often the server will check for a "
"shutdown request. (Contributed by Pedro Werneck and Jeffrey Yasskin; :issue:"
"`742598`, :issue:`1193577`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2384
msgid ""
"The :mod:`sqlite3` module, maintained by Gerhard Haering, has been updated "
"from version 2.3.2 in Python 2.5 to version 2.4.1."
msgstr ""
# 90f7592f51c6421d8b599b083149869c
#: ../src/Doc/whatsnew/2.6.rst:2388
msgid ""
"The :mod:`struct` module now supports the C99 :c:type:`_Bool` type, using "
"the format character ``'?'``. (Contributed by David Remahl.)"
msgstr ""
# 67df9e0ee30b49ada2d5839c045faf17
#: ../src/Doc/whatsnew/2.6.rst:2392
msgid ""
"The :class:`Popen` objects provided by the :mod:`subprocess` module now "
"have :meth:`terminate`, :meth:`kill`, and :meth:`send_signal` methods. On "
"Windows, :meth:`send_signal` only supports the :const:`SIGTERM` signal, and "
"all these methods are aliases for the Win32 API function :c:func:"
"`TerminateProcess`. (Contributed by Christian Heimes.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2399
msgid ""
"A new variable in the :mod:`sys` module, :attr:`float_info`, is an object "
"containing information derived from the :file:`float.h` file about the "
"platform's floating-point support. Attributes of this object include :attr:"
"`mant_dig` (number of digits in the mantissa), :attr:`epsilon` (smallest "
"difference between 1.0 and the next largest value representable), and "
"several others. (Contributed by Christian Heimes; :issue:`1534`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2407
msgid ""
"Another new variable, :attr:`dont_write_bytecode`, controls whether Python "
"writes any :file:`.pyc` or :file:`.pyo` files on importing a module. If this "
"variable is true, the compiled files are not written. The variable is "
"initially set on start-up by supplying the :option:`-B` switch to the Python "
"interpreter, or by setting the :envvar:`PYTHONDONTWRITEBYTECODE` environment "
"variable before running the interpreter. Python code can subsequently "
"change the value of this variable to control whether bytecode files are "
"written or not. (Contributed by Neal Norwitz and Georg Brandl.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2418
msgid ""
"Information about the command-line arguments supplied to the Python "
"interpreter is available by reading attributes of a named tuple available as "
"``sys.flags``. For example, the :attr:`verbose` attribute is true if Python "
"was executed in verbose mode, :attr:`debug` is true in debugging mode, etc. "
"These attributes are all read-only. (Contributed by Christian Heimes.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2426
msgid ""
"A new function, :func:`getsizeof`, takes a Python object and returns the "
"amount of memory used by the object, measured in bytes. Built-in objects "
"return correct results; third-party extensions may not, but can define a :"
"meth:`__sizeof__` method to return the object's size. (Contributed by Robert "
"Schuppenies; :issue:`2898`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2433
msgid ""
"It's now possible to determine the current profiler and tracer functions by "
"calling :func:`sys.getprofile` and :func:`sys.gettrace`. (Contributed by "
"Georg Brandl; :issue:`1648`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2437
msgid ""
"The :mod:`tarfile` module now supports POSIX.1-2001 (pax) tarfiles in "
"addition to the POSIX.1-1988 (ustar) and GNU tar formats that were already "
"supported. The default format is GNU tar; specify the ``format`` parameter "
"to open a file using a different format::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2445
msgid ""
"The new ``encoding`` and ``errors`` parameters specify an encoding and an "
"error handling scheme for character conversions. ``'strict'``, "
"``'ignore'``, and ``'replace'`` are the three standard ways Python can "
"handle errors,; ``'utf-8'`` is a special value that replaces bad characters "
"with their UTF-8 representation. (Character conversions occur because the "
"PAX format supports Unicode filenames, defaulting to UTF-8 encoding.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2453
msgid ""
"The :meth:`TarFile.add` method now accepts an ``exclude`` argument that's a "
"function that can be used to exclude certain filenames from an archive. The "
"function must take a filename and return true if the file should be excluded "
"or false if it should be archived. The function is applied to both the name "
"initially passed to :meth:`add` and to the names of files in recursively-"
"added directories."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2461
msgid "(All changes contributed by Lars Gustäbel)."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2463
msgid ""
"An optional ``timeout`` parameter was added to the :class:`telnetlib.Telnet` "
"class constructor, specifying a timeout measured in seconds. (Added by "
"Facundo Batista.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2467
msgid ""
"The :class:`tempfile.NamedTemporaryFile` class usually deletes the temporary "
"file it created when the file is closed. This behaviour can now be changed "
"by passing ``delete=False`` to the constructor. (Contributed by Damien "
"Miller; :issue:`1537850`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2472
msgid ""
"A new class, :class:`SpooledTemporaryFile`, behaves like a temporary file "
"but stores its data in memory until a maximum size is exceeded. On reaching "
"that limit, the contents will be written to an on-disk temporary file. "
"(Contributed by Dustin J. Mitchell.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2477
msgid ""
"The :class:`NamedTemporaryFile` and :class:`SpooledTemporaryFile` classes "
"both work as context managers, so you can write ``with tempfile."
"NamedTemporaryFile() as tmp: ...``. (Contributed by Alexander Belopolsky; :"
"issue:`2021`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2482
msgid ""
"The :mod:`test.test_support` module gained a number of context managers "
"useful for writing tests. :func:`EnvironmentVarGuard` is a context manager "
"that temporarily changes environment variables and automatically restores "
"them to their old values."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2488
msgid ""
"Another context manager, :class:`TransientResource`, can surround calls to "
"resources that may or may not be available; it will catch and ignore a "
"specified list of exceptions. For example, a network test may ignore "
"certain failures when connecting to an external web site::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2499
msgid ""
"Finally, :func:`check_warnings` resets the :mod:`warning` module's warning "
"filters and returns an object that will record all warning messages "
"triggered (:issue:`3781`)::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2509
msgid "(Contributed by Brett Cannon.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2511
msgid ""
"The :mod:`textwrap` module can now preserve existing whitespace at the "
"beginnings and ends of the newly-created lines by specifying "
"``drop_whitespace=False`` as an argument::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2530
msgid "(Contributed by Dwayne Bailey; :issue:`1581073`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2532
msgid ""
"The :mod:`threading` module API is being changed 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`. "
"Both the 2.6 and 3.0 versions of the module support the same properties and "
"renamed methods, but don't remove the old methods. No date has been set for "
"the deprecation of the old APIs in Python 3.x; the old APIs won't be removed "
"in any 2.x version. (Carried out by several people, most notably Benjamin "
"Peterson.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2543
msgid ""
"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`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2548
msgid ""
"The :mod:`timeit` module now accepts callables as well as strings for the "
"statement being timed and for the setup code. Two convenience functions were "
"added for creating :class:`Timer` instances: ``repeat(stmt, setup, time, "
"repeat, number)`` and ``timeit(stmt, setup, time, number)`` create an "
"instance and call the corresponding method. (Contributed by Erik Demaine; :"
"issue:`1533909`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2557
msgid ""
"The :mod:`Tkinter` module now accepts lists and tuples for options, "
"separating the elements by spaces before passing the resulting value to Tcl/"
"Tk. (Contributed by Guilherme Polo; :issue:`2906`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2562
msgid ""
"The :mod:`turtle` module for turtle graphics was greatly enhanced by Gregor "
"Lingl. New features in the module include:"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2565
msgid "Better animation of turtle movement and rotation."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2566
msgid ""
"Control over turtle movement using the new :meth:`delay`, :meth:`tracer`, "
"and :meth:`speed` methods."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2568
msgid ""
"The ability to set new shapes for the turtle, and to define a new coordinate "
"system."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2570
msgid "Turtles now have an :meth:`undo()` method that can roll back actions."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2571
msgid ""
"Simple support for reacting to input events such as mouse and keyboard "
"activity, making it possible to write simple games."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2573
msgid ""
"A :file:`turtle.cfg` file can be used to customize the starting appearance "
"of the turtle's screen."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2575
msgid ""
"The module's docstrings can be replaced by new docstrings that have been "
"translated into another language."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2578
msgid "(:issue:`1513695`)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2580
msgid ""
"An optional ``timeout`` parameter was added to the :func:`urllib.urlopen` "
"function and the :class:`urllib.ftpwrapper` class constructor, as well as "
"the :func:`urllib2.urlopen` function. The parameter specifies a timeout "
"measured in seconds. For example::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2593
msgid "(Added by Facundo Batista.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2595
msgid ""
"The Unicode database provided by the :mod:`unicodedata` module has been "
"updated to version 5.1.0. (Updated by Martin von Loewis; :issue:`3811`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2599
msgid ""
"The :mod:`warnings` module's :func:`formatwarning` and :func:`showwarning` "
"gained an optional *line* argument that can be used to supply the line of "
"source code. (Added as part of :issue:`1631171`, which re-implemented part "
"of the :mod:`warnings` module in C code.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2604
msgid ""
"A new function, :func:`catch_warnings`, is a context manager intended for "
"testing purposes that lets you temporarily modify the warning filters and "
"then restore their original values (:issue:`3781`)."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2608
msgid ""
"The XML-RPC :class:`SimpleXMLRPCServer` and :class:`DocXMLRPCServer` classes "
"can now be prevented from immediately opening and binding to their socket by "
"passing True as the ``bind_and_activate`` constructor parameter. This can "
"be used to modify the instance's :attr:`allow_reuse_address` attribute "
"before calling the :meth:`server_bind` and :meth:`server_activate` methods "
"to open the socket and begin listening for connections. (Contributed by "
"Peter Parente; :issue:`1599845`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2617
msgid ""
":class:`SimpleXMLRPCServer` also has a :attr:`_send_traceback_header` "
"attribute; if true, the exception and formatted traceback are returned as "
"HTTP headers \"X-Exception\" and \"X-Traceback\". This feature is for "
"debugging purposes only and should not be used on production servers because "
"the tracebacks might reveal passwords or other sensitive information. "
"(Contributed by Alan McIntyre as part of his project for Google's Summer of "
"Code 2007.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2625
msgid ""
"The :mod:`xmlrpclib` module no longer automatically converts :class:"
"`datetime.date` and :class:`datetime.time` to the :class:`xmlrpclib."
"DateTime` type; the conversion semantics were not necessarily correct for "
"all applications. Code using :mod:`xmlrpclib` should convert :class:`date` "
"and :class:`time` instances. (:issue:`1330538`) The code can also handle "
"dates before 1900 (contributed by Ralf Schmitt; :issue:`2014`) and 64-bit "
"integers represented by using ``<i8>`` in XML-RPC responses (contributed by "
"Riku Lindblad; :issue:`2985`)."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2635
msgid ""
"The :mod:`zipfile` module's :class:`ZipFile` class now has :meth:`extract` "
"and :meth:`extractall` methods that will unpack a single file or all the "
"files in the archive to the current directory, or to a specified directory::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2649
msgid "(Contributed by Alan McIntyre; :issue:`467924`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2651
msgid ""
"The :meth:`open`, :meth:`read` and :meth:`extract` methods can now take "
"either a filename or a :class:`ZipInfo` object. This is useful when an "
"archive accidentally contains a duplicated filename. (Contributed by Graham "
"Horler; :issue:`1775025`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2656
msgid ""
"Finally, :mod:`zipfile` now supports using Unicode filenames for archived "
"files. (Contributed by Alexey Borzenkov; :issue:`1734346`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2663
msgid "The :mod:`ast` module"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2665
msgid ""
"The :mod:`ast` module provides an Abstract Syntax Tree representation of "
"Python code, and Armin Ronacher contributed a set of helper functions that "
"perform a variety of common tasks. These will be useful for HTML templating "
"packages, code analyzers, and similar tools that process Python code."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2672
msgid ""
"The :func:`parse` function takes an expression and returns an AST. The :func:"
"`dump` function outputs a representation of a tree, suitable for debugging::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2686
msgid "This outputs a deeply nested tree::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2719
msgid ""
"The :func:`literal_eval` method takes a string or an AST representing a "
"literal expression, parses and evaluates it, and returns the resulting "
"value. A literal expression is a Python expression containing only strings, "
"numbers, dictionaries, etc. but no statements or function calls. If you "
"need to evaluate an expression but cannot accept the security risk of using "
"an :func:`eval` call, :func:`literal_eval` will handle it safely::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2735
msgid ""
"The module also includes :class:`NodeVisitor` and :class:`NodeTransformer` "
"classes for traversing and modifying an AST, and functions for common "
"transformations such as changing line numbers."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2743
msgid "The :mod:`future_builtins` module"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2745
msgid ""
"Python 3.0 makes many changes to the repertoire of built-in functions, and "
"most of the changes can't be introduced in the Python 2.x series because "
"they would break compatibility. The :mod:`future_builtins` module provides "
"versions of these built-in functions that can be imported when writing 3.0-"
"compatible code."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2752
msgid "The functions in this module currently include:"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2754
msgid ""
"``ascii(obj)``: equivalent to :func:`repr`. In Python 3.0, :func:`repr` "
"will return a Unicode string, while :func:`ascii` will return a pure ASCII "
"bytestring."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2758
msgid ""
"``filter(predicate, iterable)``, ``map(func, iterable1, ...)``: the 3.0 "
"versions return iterators, unlike the 2.x builtins which return lists."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2762
msgid ""
"``hex(value)``, ``oct(value)``: instead of calling the :meth:`__hex__` or :"
"meth:`__oct__` methods, these versions will call the :meth:`__index__` "
"method and convert the result to hexadecimal or octal. :func:`oct` will use "
"the new ``0o`` notation for its result."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2771
msgid "The :mod:`json` module: JavaScript Object Notation"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2773
msgid ""
"The new :mod:`json` module supports the encoding and decoding of Python "
"types in JSON (Javascript Object Notation). JSON is a lightweight "
"interchange format often used in web applications. For more information "
"about JSON, see http://www.json.org."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2778
msgid ""
":mod:`json` comes with support for decoding and encoding most built-in "
"Python types. The following example encodes and decodes a dictionary::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2789
msgid ""
"It's also possible to write your own decoders and encoders to support more "
"types. Pretty-printing of the JSON strings is also supported."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2792
msgid ":mod:`json` (originally called simplejson) was written by Bob Ippolito."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2799
msgid "The :mod:`plistlib` module: A Property-List Parser"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2801
msgid ""
"The ``.plist`` format is commonly used on Mac OS X to store basic data types "
"(numbers, strings, lists, and dictionaries) by serializing them into an XML-"
"based format. It resembles the XML-RPC serialization of data types."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2806
msgid ""
"Despite being primarily used on Mac OS X, the format has nothing Mac-"
"specific about it and the Python implementation works on any platform that "
"Python supports, so the :mod:`plistlib` module has been promoted to the "
"standard library."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2811
msgid "Using the module is simple::"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2838
msgid "ctypes Enhancements"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2840
msgid ""
"Thomas Heller continued to maintain and enhance the :mod:`ctypes` module."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2843
msgid ""
":mod:`ctypes` now supports a :class:`c_bool` datatype that represents the "
"C99 ``bool`` type. (Contributed by David Remahl; :issue:`1649190`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2847
msgid ""
"The :mod:`ctypes` string, buffer and array types have improved support for "
"extended slicing syntax, where various combinations of ``(start, stop, "
"step)`` are supplied. (Implemented by Thomas Wouters.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2854
msgid ""
"All :mod:`ctypes` data types now support :meth:`from_buffer` and :meth:"
"`from_buffer_copy` methods that create a ctypes instance based on a provided "
"buffer object. :meth:`from_buffer_copy` copies the contents of the object, "
"while :meth:`from_buffer` will share the same memory area."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2861
msgid ""
"A new calling convention tells :mod:`ctypes` to clear the ``errno`` or Win32 "
"LastError variables at the outset of each wrapped call. (Implemented by "
"Thomas Heller; :issue:`1798`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2865
msgid ""
"You can now retrieve the Unix ``errno`` variable after a function call. "
"When creating a wrapped function, you can supply ``use_errno=True`` as a "
"keyword parameter to the :func:`DLL` function and then call the module-level "
"methods :meth:`set_errno` and :meth:`get_errno` to set and retrieve the "
"error value."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2871
msgid ""
"The Win32 LastError variable is similarly supported by the :func:`DLL`, :"
"func:`OleDLL`, and :func:`WinDLL` functions. You supply "
"``use_last_error=True`` as a keyword parameter and then call the module-"
"level methods :meth:`set_last_error` and :meth:`get_last_error`."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2877
msgid ""
"The :func:`byref` function, used to retrieve a pointer to a ctypes instance, "
"now has an optional *offset* parameter that is a byte count that will be "
"added to the returned pointer."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2884
msgid "Improved SSL Support"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2886
msgid ""
"Bill Janssen made extensive improvements to Python 2.6's support for the "
"Secure Sockets Layer by adding a new module, :mod:`ssl`, that's built atop "
"the `OpenSSL <http://www.openssl.org/>`__ library. This new module provides "
"more control over the protocol negotiated, the X.509 certificates used, and "
"has better support for writing SSL servers (as opposed to clients) in "
"Python. The existing SSL support in the :mod:`socket` module hasn't been "
"removed and continues to work, though it will be removed in Python 3.0."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2895
msgid ""
"To use the new module, you must first create a TCP connection in the usual "
"way and then pass it to the :func:`ssl.wrap_socket` function. It's possible "
"to specify whether a certificate is required, and to obtain certificate info "
"by calling the :meth:`getpeercert` method."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2902
msgid "The documentation for the :mod:`ssl` module."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2907
msgid "Deprecations and Removals"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2909 ../src/Doc/whatsnew/2.6.rst:3237
msgid ""
"String exceptions have been removed. Attempting to use them raises a :exc:"
"`TypeError`."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2912
msgid ""
"Changes to the :class:`Exception` interface as dictated by :pep:`352` "
"continue to be made. For 2.6, the :attr:`message` attribute is being "
"deprecated in favor of the :attr:`args` attribute."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2917
msgid ""
"(3.0-warning mode) Python 3.0 will feature a reorganized standard library "
"that will drop many outdated modules and rename others. Python 2.6 running "
"in 3.0-warning mode will warn about these modules when they are imported."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2922
msgid ""
"The list of deprecated modules is: :mod:`audiodev`, :mod:`bgenlocations`, :"
"mod:`buildtools`, :mod:`bundlebuilder`, :mod:`Canvas`, :mod:`compiler`, :mod:"
"`dircache`, :mod:`dl`, :mod:`fpformat`, :mod:`gensuitemodule`, :mod:"
"`ihooks`, :mod:`imageop`, :mod:`imgfile`, :mod:`linuxaudiodev`, :mod:"
"`mhlib`, :mod:`mimetools`, :mod:`multifile`, :mod:`new`, :mod:`pure`, :mod:"
"`statvfs`, :mod:`sunaudiodev`, :mod:`test.testall`, and :mod:`toaiff`."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2947
msgid "The :mod:`gopherlib` module has been removed."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2949
msgid ""
"The :mod:`MimeWriter` module and :mod:`mimify` module have been deprecated; "
"use the :mod:`email` package instead."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2953
msgid ""
"The :mod:`md5` module has been deprecated; use the :mod:`hashlib` module "
"instead."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2956
msgid ""
"The :mod:`posixfile` module has been deprecated; :func:`fcntl.lockf` "
"provides better locking."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2959
msgid ""
"The :mod:`popen2` module has been deprecated; use the :mod:`subprocess` "
"module."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2962
msgid "The :mod:`rgbimg` module has been removed."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2964
msgid ""
"The :mod:`sets` module has been deprecated; it's better to use the built-in :"
"class:`set` and :class:`frozenset` types."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2967
msgid ""
"The :mod:`sha` module has been deprecated; use the :mod:`hashlib` module "
"instead."
msgstr ""
# cc38f69b537542d3b009dcdbcd217905
#: ../src/Doc/whatsnew/2.6.rst:2979
msgid ""
"Python now must be compiled with C89 compilers (after 19 years!). This "
"means that the Python source tree has dropped its own implementations of :c:"
"func:`memmove` and :c:func:`strerror`, which are in the C89 standard library."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2984
msgid ""
"Python 2.6 can be built with Microsoft Visual Studio 2008 (version 9.0), and "
"this is the new default compiler. See the :file:`PCbuild` directory for the "
"build files. (Implemented by Christian Heimes.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2989
msgid ""
"On Mac OS X, Python 2.6 can be compiled as a 4-way universal build. The :"
"program:`configure` script can take a :option:`--with-universal-archs=[32-"
"bit|64-bit|all]` switch, controlling whether the binaries are built for 32-"
"bit architectures (x86, PowerPC), 64-bit (x86-64 and PPC-64), or both. "
"(Contributed by Ronald Oussoren.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:2996
msgid ""
"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.)"
msgstr ""
# cdf4a2a94ad44b7ab2343a983e697fbe
#: ../src/Doc/whatsnew/2.6.rst:3001
msgid ""
"The new buffer interface, previously described in `the PEP 3118 section "
"<#pep-3118-revised-buffer-protocol>`__, adds :c:func:`PyObject_GetBuffer` "
"and :c:func:`PyBuffer_Release`, as well as a few other functions."
msgstr ""
# d8b19ee8969e49c28aa981090605a928
#: ../src/Doc/whatsnew/2.6.rst:3006
msgid ""
"Python's use of the C stdio library is now thread-safe, or at least as "
"thread-safe as the underlying library is. A long-standing potential bug "
"occurred if one thread closed a file object while another thread was reading "
"from or writing to the object. In 2.6 file objects have a reference count, "
"manipulated by the :c:func:`PyFile_IncUseCount` and :c:func:"
"`PyFile_DecUseCount` functions. File objects can't be closed unless the "
"reference count is zero. :c:func:`PyFile_IncUseCount` should be called "
"while the GIL is still held, before carrying out an I/O operation using the "
"``FILE *`` pointer, and :c:func:`PyFile_DecUseCount` should be called "
"immediately after the GIL is re-acquired. (Contributed by Antoine Pitrou and "
"Gregory P. Smith.)"
msgstr ""
# a99be85f0aca44eab799a3dfaba899c4
#: ../src/Doc/whatsnew/2.6.rst:3019
msgid ""
"Importing modules simultaneously in two different threads no longer "
"deadlocks; it will now raise an :exc:`ImportError`. A new API function, :c:"
"func:`PyImport_ImportModuleNoBlock`, will look for a module in ``sys."
"modules`` first, then try to import it after acquiring an import lock. If "
"the import lock is held by another thread, an :exc:`ImportError` is raised. "
"(Contributed by Christian Heimes.)"
msgstr ""
# 2f30a14d040e4bc5a7a94d1e88654f47
#: ../src/Doc/whatsnew/2.6.rst:3027
msgid ""
"Several functions return information about the platform's floating-point "
"support. :c:func:`PyFloat_GetMax` returns the maximum representable "
"floating point value, and :c:func:`PyFloat_GetMin` returns the minimum "
"positive value. :c:func:`PyFloat_GetInfo` returns an object containing more "
"information from the :file:`float.h` file, such as ``\"mant_dig\"`` (number "
"of digits in the mantissa), ``\"epsilon\"`` (smallest difference between 1.0 "
"and the next largest value representable), and several others. (Contributed "
"by Christian Heimes; :issue:`1534`.)"
msgstr ""
# b99e3ac8567343b0b2b79dba8ada1e25
#: ../src/Doc/whatsnew/2.6.rst:3038
msgid ""
"C functions and methods that use :c:func:`PyComplex_AsCComplex` will now "
"accept arguments that have a :meth:`__complex__` method. In particular, the "
"functions in the :mod:`cmath` module will now accept objects with this "
"method. This is a backport of a Python 3.0 change. (Contributed by Mark "
"Dickinson; :issue:`1675423`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:3045
msgid ""
"Python's C API now includes two functions for case-insensitive string "
"comparisons, ``PyOS_stricmp(char*, char*)`` and ``PyOS_strnicmp(char*, "
"char*, Py_ssize_t)``. (Contributed by Christian Heimes; :issue:`1635`.)"
msgstr ""
# c1b855820de349878d93de57f89adc23
#: ../src/Doc/whatsnew/2.6.rst:3050
msgid ""
"Many C extensions define their own little macro for adding integers and "
"strings to the module's dictionary in the ``init*`` function. Python 2.6 "
"finally defines standard macros for adding values to a module, :c:macro:"
"`PyModule_AddStringMacro` and :c:macro:`PyModule_AddIntMacro()`. "
"(Contributed by Christian Heimes.)"
msgstr ""
# 75baa71c7eb84b46a2d50d2d59727600
#: ../src/Doc/whatsnew/2.6.rst:3057
msgid ""
"Some macros were renamed in both 3.0 and 2.6 to make it clearer that they "
"are macros, not functions. :c:macro:`Py_Size()` became :c:macro:"
"`Py_SIZE()`, :c:macro:`Py_Type()` became :c:macro:`Py_TYPE()`, and :c:macro:"
"`Py_Refcnt()` became :c:macro:`Py_REFCNT()`. The mixed-case macros are still "
"available in Python 2.6 for backward compatibility. (:issue:`1629`)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:3066
msgid ""
"Distutils now places C extensions it builds in a different directory when "
"running on a debug version of Python. (Contributed by Collin Winter; :issue:"
"`1530959`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:3070
msgid ""
"Several basic data types, such as integers and strings, maintain internal "
"free lists of objects that can be re-used. The data structures for these "
"free lists now follow a naming convention: the variable is always named "
"``free_list``, the counter is always named ``numfree``, and a macro "
"``Py<typename>_MAXFREELIST`` is always defined."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:3077
msgid ""
"A new Makefile target, \"make patchcheck\", prepares the Python source tree "
"for making a patch: it fixes trailing whitespace in all modified ``.py`` "
"files, checks whether the documentation has been changed, and reports "
"whether the :file:`Misc/ACKS` and :file:`Misc/NEWS` files have been updated. "
"(Contributed by Brett Cannon.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:3084
msgid ""
"Another new target, \"make profile-opt\", compiles a Python binary using "
"GCC's profile-guided optimization. It compiles Python with profiling "
"enabled, runs the test suite to obtain a set of profiling results, and then "
"compiles using these results for optimization. (Contributed by Gregory P. "
"Smith.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:3093 ../src/Doc/whatsnew/2.7.rst:2299
msgid "Port-Specific Changes: Windows"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:3095
msgid ""
"The support for Windows 95, 98, ME and NT4 has been dropped. Python 2.6 "
"requires at least Windows 2000 SP4."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:3098
msgid ""
"The new default compiler on Windows is Visual Studio 2008 (version 9.0). The "
"build directories for Visual Studio 2003 (version 7.1) and 2005 (version "
"8.0) were moved into the PC/ directory. The new :file:`PCbuild` directory "
"supports cross compilation for X64, debug builds and Profile Guided "
"Optimization (PGO). PGO builds are roughly 10% faster than normal builds. "
"(Contributed by Christian Heimes with help from Amaury Forgeot d'Arc and "
"Martin von Loewis.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:3106
msgid ""
"The :mod:`msvcrt` module now supports both the normal and wide char variants "
"of the console I/O API. The :func:`getwch` function reads a keypress and "
"returns a Unicode value, as does the :func:`getwche` function. The :func:"
"`putwch` function takes a Unicode character and writes it to the console. "
"(Contributed by Christian Heimes.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:3113
msgid ""
":func:`os.path.expandvars` will now expand environment variables in the form "
"\"%var%\", and \"~user\" will be expanded into the user's home directory "
"path. (Contributed by Josiah Carlson; :issue:`957650`.)"
msgstr ""
# 04babcb9bacc410f815f8ebac76c0838
#: ../src/Doc/whatsnew/2.6.rst:3117
msgid ""
"The :mod:`socket` module's socket objects now have an :meth:`ioctl` method "
"that provides a limited interface to the :c:func:`WSAIoctl` system interface."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:3121
msgid ""
"The :mod:`_winreg` module now has a function, :func:"
"`ExpandEnvironmentStrings`, that expands environment variable references "
"such as ``%NAME%`` in an input string. The handle objects provided by this "
"module now support the context protocol, so they can be used in :keyword:"
"`with` statements. (Contributed by Christian Heimes.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:3128
msgid ""
":mod:`_winreg` also has better support for x64 systems, exposing the :func:"
"`DisableReflectionKey`, :func:`EnableReflectionKey`, and :func:"
"`QueryReflectionKey` functions, which enable and disable registry reflection "
"for 32-bit processes running on 64-bit systems. (:issue:`1753245`)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:3134
msgid ""
"The :mod:`msilib` module's :class:`Record` object gained :meth:`GetInteger` "
"and :meth:`GetString` methods that return field values as an integer or a "
"string. (Contributed by Floris Bruynooghe; :issue:`2125`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:3142 ../src/Doc/whatsnew/2.7.rst:2337
msgid "Port-Specific Changes: Mac OS X"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:3144
msgid ""
"When compiling a framework build of Python, you can now specify the "
"framework name to be used by providing the :option:`--with-framework-name=` "
"option to the :program:`configure` script."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:3149
msgid ""
"The :mod:`macfs` module has been removed. This in turn required the :func:"
"`macostools.touched` function to be removed because it depended on the :mod:"
"`macfs` module. (:issue:`1490190`)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:3153
msgid ""
"Many other Mac OS modules have been deprecated and will removed in Python "
"3.0: :mod:`_builtinSuites`, :mod:`aepack`, :mod:`aetools`, :mod:`aetypes`, :"
"mod:`applesingle`, :mod:`appletrawmain`, :mod:`appletrunner`, :mod:"
"`argvemulator`, :mod:`Audio_mac`, :mod:`autoGIL`, :mod:`Carbon`, :mod:"
"`cfmfile`, :mod:`CodeWarrior`, :mod:`ColorPicker`, :mod:`EasyDialogs`, :mod:"
"`Explorer`, :mod:`Finder`, :mod:`FrameWork`, :mod:`findertools`, :mod:`ic`, :"
"mod:`icglue`, :mod:`icopen`, :mod:`macerrors`, :mod:`MacOS`, :mod:`macfs`, :"
"mod:`macostools`, :mod:`macresource`, :mod:`MiniAEFrame`, :mod:`Nav`, :mod:"
"`Netscape`, :mod:`OSATerminology`, :mod:`pimp`, :mod:`PixMapWrapper`, :mod:"
"`StdSuites`, :mod:`SystemEvents`, :mod:`Terminal`, and :mod:"
"`terminalcommand`."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:3196
msgid "Port-Specific Changes: IRIX"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:3198
msgid ""
"A number of old IRIX-specific modules were deprecated and will be removed in "
"Python 3.0: :mod:`al` and :mod:`AL`, :mod:`cd`, :mod:`cddb`, :mod:"
"`cdplayer`, :mod:`CL` and :mod:`cl`, :mod:`DEVICE`, :mod:`ERRNO`, :mod:"
"`FILE`, :mod:`FL` and :mod:`fl`, :mod:`flp`, :mod:`fm`, :mod:`GET`, :mod:"
"`GLWS`, :mod:`GL` and :mod:`gl`, :mod:`IN`, :mod:`IOCTL`, :mod:`jpeg`, :mod:"
"`panelparser`, :mod:`readcd`, :mod:`SV` and :mod:`sv`, :mod:`torgb`, :mod:"
"`videoreader`, and :mod:`WAIT`."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:3228
msgid "Porting to Python 2.6"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:3230 ../src/Doc/whatsnew/2.7.rst:2399
msgid ""
"This section lists previously described changes and other bugfixes that may "
"require changes to your code:"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:3233
msgid ""
"Classes that aren't supposed to be hashable should set ``__hash__ = None`` "
"in their definitions to indicate the fact."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:3240
msgid ""
"The :meth:`__init__` method of :class:`collections.deque` now clears any "
"existing contents of the deque before adding elements from the iterable. "
"This change makes the behavior match ``list.__init__()``."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:3245
msgid ""
":meth:`object.__init__` previously accepted arbitrary arguments and keyword "
"arguments, ignoring them. In Python 2.6, this is no longer allowed and will "
"result in a :exc:`TypeError`. This will affect :meth:`__init__` methods "
"that end up calling the corresponding method on :class:`object` (perhaps "
"through using :func:`super`). See :issue:`1683368` for discussion."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:3252
msgid ""
"The :class:`Decimal` constructor now accepts leading and trailing whitespace "
"when passed a string. Previously it would raise an :exc:`InvalidOperation` "
"exception. On the other hand, the :meth:`create_decimal` method of :class:"
"`Context` objects now explicitly disallows extra whitespace, raising a :exc:"
"`ConversionSyntax` exception."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:3259
msgid ""
"Due to an implementation accident, if you passed a file path to the built-"
"in :func:`__import__` function, it would actually import the specified "
"file. This was never intended to work, however, and the implementation now "
"explicitly checks for this case and raises an :exc:`ImportError`."
msgstr ""
# a19d25b087a14368ad1d8b46083bf753
#: ../src/Doc/whatsnew/2.6.rst:3265
msgid ""
"C API: the :c:func:`PyImport_Import` and :c:func:`PyImport_ImportModule` "
"functions now default to absolute imports, not relative imports. This will "
"affect C extensions that import other modules."
msgstr ""
# c2afc431ad67493499130c6d698739ac
#: ../src/Doc/whatsnew/2.6.rst:3269
msgid ""
"C API: extension data types that shouldn't be hashable should define their "
"``tp_hash`` slot to :c:func:`PyObject_HashNotImplemented`."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:3273
msgid ""
"The :mod:`socket` module exception :exc:`socket.error` now inherits from :"
"exc:`IOError`. Previously it wasn't a subclass of :exc:`StandardError` but "
"now it is, through :exc:`IOError`. (Implemented by Gregory P. Smith; :issue:"
"`1706815`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:3278
msgid ""
"The :mod:`xmlrpclib` module no longer automatically converts :class:"
"`datetime.date` and :class:`datetime.time` to the :class:`xmlrpclib."
"DateTime` type; the conversion semantics were not necessarily correct for "
"all applications. Code using :mod:`xmlrpclib` should convert :class:`date` "
"and :class:`time` instances. (:issue:`1330538`)"
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:3285
msgid ""
"(3.0-warning mode) The :class:`Exception` class now warns when accessed "
"using slicing or index access; having :class:`Exception` behave like a tuple "
"is being phased out."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:3289
msgid ""
"(3.0-warning mode) inequality comparisons between two dictionaries or two "
"objects that don't implement comparison methods are reported as warnings. "
"``dict1 == dict2`` still works, but ``dict1 < dict2`` is being phased out."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:3294
msgid ""
"Comparisons between cells, which are an implementation detail of Python's "
"scoping rules, also cause warnings because such comparisons are forbidden "
"entirely in 3.0."
msgstr ""
#: ../src/Doc/whatsnew/2.6.rst:3306
msgid ""
"The author would like to thank the following people for offering "
"suggestions, corrections and assistance with various drafts of this article: "
"Georg Brandl, Steve Brown, Nick Coghlan, Ralph Corderoy, Jim Jewett, Kent "
"Johnson, Chris Lambacher, Martin Michlmayr, Antoine Pitrou, Brian Warner."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:3
msgid "What's New in Python 2.7"
msgstr ""
# 486930ef6f9c4f0abe7d40c5d844a25f
#: ../src/Doc/whatsnew/2.7.rst:52
msgid ""
"This article explains the new features in Python 2.7. Python 2.7 was "
"released on July 3, 2010."
msgstr ""
# d9e34d363f254dd9a82909f60792df54
#: ../src/Doc/whatsnew/2.7.rst:55
msgid ""
"Numeric handling has been improved in many ways, for both floating-point "
"numbers and for the :class:`~decimal.Decimal` class. There are some useful "
"additions to the standard library, such as a greatly enhanced :mod:"
"`unittest` module, the :mod:`argparse` module for parsing command-line "
"options, convenient :class:`~collections.OrderedDict` and :class:"
"`~collections.Counter` classes in the :mod:`collections` module, and many "
"other improvements."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:63
msgid ""
"Python 2.7 is planned to be the last of the 2.x releases, so we worked on "
"making it a good release for the long term. To help with porting to Python "
"3, several new features from the Python 3.x series have been included in 2.7."
msgstr ""
# 76f16953e73340d5bd2a09a6e63f461d
#: ../src/Doc/whatsnew/2.7.rst:68
msgid ""
"This article doesn't attempt to provide a complete specification of the new "
"features, but instead provides a convenient overview. For full details, you "
"should refer to the documentation for Python 2.7 at https://docs.python.org. "
"If you want to understand the rationale for the design and implementation, "
"refer to the PEP for a particular new feature or the issue on https://bugs."
"python.org in which a change was discussed. Whenever possible, \"What's New "
"in Python\" links to the bug/patch item for each change."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:80
msgid "The Future for Python 2.x"
msgstr ""
# 0fd737fb6af04b5b875510b6e6ed23fd
#: ../src/Doc/whatsnew/2.7.rst:82
msgid ""
"Python 2.7 is the last major release in the 2.x series, as the Python "
"maintainers have shifted the focus of their new feature development efforts "
"to the Python 3.x series. This means that while Python 2 continues to "
"receive bug fixes, and to be updated to build correctly on new hardware and "
"versions of supported operated systems, there will be no new full feature "
"releases for the language or standard library."
msgstr ""
# 3135281466114e9db0d9f5eb548cab55
#: ../src/Doc/whatsnew/2.7.rst:89
msgid ""
"However, while there is a large common subset between Python 2.7 and Python "
"3, and many of the changes involved in migrating to that common subset, or "
"directly to Python 3, can be safely automated, some other changes (notably "
"those associated with Unicode handling) may require careful consideration, "
"and preferably robust automated regression test suites, to migrate "
"effectively."
msgstr ""
# 0d7f00f5ff544a1192b3dfb7264090fe
#: ../src/Doc/whatsnew/2.7.rst:96
msgid ""
"This means that Python 2.7 will remain in place for a long time, providing a "
"stable and supported base platform for production systems that have not yet "
"been ported to Python 3. The full expected lifecycle of the Python 2.7 "
"series is detailed in :pep:`373`."
msgstr ""
# 30ec41b0b5774c04b29ad2b79a049557
#: ../src/Doc/whatsnew/2.7.rst:101
msgid "Some key consequences of the long-term significance of 2.7 are:"
msgstr ""
# f8a215805a5743538002e7c9fae1fca7
#: ../src/Doc/whatsnew/2.7.rst:103
msgid ""
"As noted above, the 2.7 release has a much longer period of maintenance when "
"compared to earlier 2.x versions. Python 2.7 is currently expected to remain "
"supported by the core development team (receiving security updates and other "
"bug fixes) until at least 2020 (10 years after its initial release, compared "
"to the more typical support period of 18-24 months)."
msgstr ""
# 970524919a5c44f2b6a727094e4ec76f
#: ../src/Doc/whatsnew/2.7.rst:109
msgid ""
"As the Python 2.7 standard library ages, making effective use of the Python "
"Package Index (either directly or via a redistributor) becomes more "
"important for Python 2 users. In addition to a wide variety of third party "
"packages for various tasks, the available packages include backports of new "
"modules and features from the Python 3 standard library that are compatible "
"with Python 2, as well as various tools and libraries that can make it "
"easier to migrate to Python 3. The `Python Packaging User Guide <https://"
"packaging.python.org>`__ provides guidance on downloading and installing "
"software from the Python Package Index."
msgstr ""
# 3bfc5da850444aa28a0f867dd445fb39
#: ../src/Doc/whatsnew/2.7.rst:119
msgid ""
"While the preferred approach to enhancing Python 2 is now the publication of "
"new packages on the Python Package Index, this approach doesn't necessarily "
"work in all cases, especially those related to network security. In "
"exceptional cases that cannot be handled adequately by publishing new or "
"updated packages on PyPI, the Python Enhancement Proposal process may be "
"used to make the case for adding new features directly to the Python 2 "
"standard library. Any such additions, and the maintenance releases where "
"they were added, will be noted in the :ref:`py27-maintenance-enhancements` "
"section below."
msgstr ""
# 1aff3e115fed4f248ae9b18c1743c31e
#: ../src/Doc/whatsnew/2.7.rst:129
msgid ""
"For projects wishing to migrate from Python 2 to Python 3, or for library "
"and framework developers wishing to support users on both Python 2 and "
"Python 3, there are a variety of tools and guides available to help decide "
"on a suitable approach and manage some of the technical details involved. "
"The recommended starting point is the :ref:`pyporting-howto` HOWTO guide."
msgstr ""
# a5099d4a9a204342823ae2d1d6837fa4
#: ../src/Doc/whatsnew/2.7.rst:137
msgid "Changes to the Handling of Deprecation Warnings"
msgstr ""
# dc290132d64c49a6a391688e014a66ba
#: ../src/Doc/whatsnew/2.7.rst:139
msgid ""
"For Python 2.7, a policy decision was made to silence warnings only of "
"interest to developers by default. :exc:`DeprecationWarning` and its "
"descendants are now ignored unless otherwise requested, preventing users "
"from seeing warnings triggered by an application. This change was also made "
"in the branch that became Python 3.2. (Discussed on stdlib-sig and carried "
"out in :issue:`7319`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:146
msgid ""
"In previous releases, :exc:`DeprecationWarning` messages were enabled by "
"default, providing Python developers with a clear indication of where their "
"code may break in a future major version of Python."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:151
msgid ""
"However, there are increasingly many users of Python-based applications who "
"are not directly involved in the development of those applications. :exc:"
"`DeprecationWarning` messages are irrelevant to such users, making them "
"worry about an application that's actually working correctly and burdening "
"application developers with responding to these concerns."
msgstr ""
# 44a74749b1cd40c582fe08fea5dcc88c
#: ../src/Doc/whatsnew/2.7.rst:158
msgid ""
"You can re-enable display of :exc:`DeprecationWarning` messages by running "
"Python with the :option:`-Wdefault <-W>` (short form: :option:`-Wd <-W>`) "
"switch, or by setting the :envvar:`PYTHONWARNINGS` environment variable to ``"
"\"default\"`` (or ``\"d\"``) before running Python. Python code can also re-"
"enable them by calling ``warnings.simplefilter('default')``."
msgstr ""
# c0a4c74257dc49fda816116389db66b7
#: ../src/Doc/whatsnew/2.7.rst:165
msgid ""
"The ``unittest`` module also automatically reenables deprecation warnings "
"when running tests."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:170
msgid "Python 3.1 Features"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:172
msgid ""
"Much as Python 2.6 incorporated features from Python 3.0, version 2.7 "
"incorporates some of the new features in Python 3.1. The 2.x series "
"continues to provide tools for migrating to the 3.x series."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:177
msgid "A partial list of 3.1 features that were backported to 2.7:"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:179
msgid "The syntax for set literals (``{1,2,3}`` is a mutable set)."
msgstr ""
# 06803aa803544424bc4e85556504fa87
#: ../src/Doc/whatsnew/2.7.rst:180
msgid "Dictionary and set comprehensions (``{i: i*2 for i in range(3)}``)."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:181
msgid "Multiple context managers in a single :keyword:`with` statement."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:182
msgid "A new version of the :mod:`io` library, rewritten in C for performance."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:183
msgid "The ordered-dictionary type described in :ref:`pep-0372`."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:184
msgid "The new ``\",\"`` format specifier described in :ref:`pep-0378`."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:185
msgid "The :class:`memoryview` object."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:186
msgid ""
"A small subset of the :mod:`importlib` module, `described below <#importlib-"
"section>`__."
msgstr ""
# 09dc1b9e535a4cda8a47872e19bf60f7
#: ../src/Doc/whatsnew/2.7.rst:188
msgid ""
"The :func:`repr` of a float ``x`` is shorter in many cases: it's now based "
"on the shortest decimal string that's guaranteed to round back to ``x``. As "
"in previous versions of Python, it's guaranteed that ``float(repr(x))`` "
"recovers ``x``."
msgstr ""
# 754091649c754e5aba6575c8121de58d
#: ../src/Doc/whatsnew/2.7.rst:192
msgid ""
"Float-to-string and string-to-float conversions are correctly rounded. The :"
"func:`round` function is also now correctly rounded."
msgstr ""
# 1b44809531e446d6a5ca648852287ee7
#: ../src/Doc/whatsnew/2.7.rst:194
msgid ""
"The :c:type:`PyCapsule` type, used to provide a C API for extension modules."
msgstr ""
# ea84532b53414f61b43e56e5919c3467
#: ../src/Doc/whatsnew/2.7.rst:195
msgid "The :c:func:`PyLong_AsLongAndOverflow` C API function."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:197
msgid "Other new Python3-mode warnings include:"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:199
msgid ""
":func:`operator.isCallable` and :func:`operator.sequenceIncludes`, which are "
"not supported in 3.x, now trigger warnings."
msgstr ""
# 4670c73ef4104a689b4d587ba20facc1
#: ../src/Doc/whatsnew/2.7.rst:201
msgid ""
"The :option:`-3` switch now automatically enables the :option:`-Qwarn <-Q>` "
"switch that causes warnings about using classic division with integers and "
"long integers."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:214
msgid "PEP 372: Adding an Ordered Dictionary to collections"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:216
msgid ""
"Regular Python dictionaries iterate over key/value pairs in arbitrary order. "
"Over the years, a number of authors have written alternative implementations "
"that remember the order that the keys were originally inserted. Based on "
"the experiences from those implementations, 2.7 introduces a new :class:"
"`~collections.OrderedDict` class in the :mod:`collections` module."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:222
msgid ""
"The :class:`~collections.OrderedDict` API provides the same interface as "
"regular dictionaries but iterates over keys and values in a guaranteed order "
"depending on when a key was first inserted::"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:233
msgid ""
"If a new entry overwrites an existing entry, the original insertion position "
"is left unchanged::"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:240
msgid "Deleting an entry and reinserting it will move it to the end::"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:247
msgid ""
"The :meth:`~collections.OrderedDict.popitem` method has an optional *last* "
"argument that defaults to True. If *last* is True, the most recently added "
"key is returned and removed; if it's False, the oldest key is selected::"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:262
msgid ""
"Comparing two ordered dictionaries checks both the keys and values, and "
"requires that the insertion order was the same::"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:278
msgid ""
"Comparing an :class:`~collections.OrderedDict` with a regular dictionary "
"ignores the insertion order and just compares the keys and values."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:281
msgid ""
"How does the :class:`~collections.OrderedDict` work? It maintains a doubly-"
"linked list of keys, appending new keys to the list as they're inserted. A "
"secondary dictionary maps keys to their corresponding list node, so deletion "
"doesn't have to traverse the entire linked list and therefore remains O(1)."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:287
msgid ""
"The standard library now supports use of ordered dictionaries in several "
"modules."
msgstr ""
# 29176d01d12b4ea7b1e60abf7336c543
#: ../src/Doc/whatsnew/2.7.rst:290
msgid ""
"The :mod:`ConfigParser` module uses them by default, meaning that "
"configuration files can now be read, modified, and then written back in "
"their original order."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:294
msgid ""
"The :meth:`~collections.somenamedtuple._asdict()` method for :func:"
"`collections.namedtuple` now returns an ordered dictionary with the values "
"appearing in the same order as the underlying tuple indices."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:298
msgid ""
"The :mod:`json` module's :class:`~json.JSONDecoder` class constructor was "
"extended with an *object_pairs_hook* parameter to allow :class:`OrderedDict` "
"instances to be built by the decoder. Support was also added for third-party "
"tools like `PyYAML <http://pyyaml.org/>`_."
msgstr ""
# 26736a02e228461eb4bfa7d548d4ef60
#: ../src/Doc/whatsnew/2.7.rst:306
msgid ":pep:`372` - Adding an ordered dictionary to collections"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:307
msgid ""
"PEP written by Armin Ronacher and Raymond Hettinger; implemented by Raymond "
"Hettinger."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:313
msgid "PEP 378: Format Specifier for Thousands Separator"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:315
msgid ""
"To make program output more readable, it can be useful to add separators to "
"large numbers, rendering them as 18,446,744,073,709,551,616 instead of "
"18446744073709551616."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:319
msgid ""
"The fully general solution for doing this is the :mod:`locale` module, which "
"can use different separators (\",\" in North America, \".\" in Europe) and "
"different grouping sizes, but :mod:`locale` is complicated to use and "
"unsuitable for multi-threaded applications where different threads are "
"producing output for different locales."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:325
msgid ""
"Therefore, a simple comma-grouping mechanism has been added to the mini-"
"language used by the :meth:`str.format` method. When formatting a floating-"
"point number, simply include a comma between the width and the precision::"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:333
msgid "When formatting an integer, include the comma after the width:"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:338
msgid ""
"This mechanism is not adaptable at all; commas are always used as the "
"separator and the grouping is always into three-digit groups. The comma-"
"formatting mechanism isn't as general as the :mod:`locale` module, but it's "
"easier to use."
msgstr ""
# c54475c586c34cbd9520b29e5b5784df
#: ../src/Doc/whatsnew/2.7.rst:344
msgid ":pep:`378` - Format Specifier for Thousands Separator"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:346
msgid "PEP written by Raymond Hettinger; implemented by Eric Smith."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:349
msgid "PEP 389: The argparse Module for Parsing Command Lines"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:351
msgid ""
"The :mod:`argparse` module for parsing command-line arguments was added as a "
"more powerful replacement for the :mod:`optparse` module."
msgstr ""
# 445dd6ecd4144a319a53acc662e1e43f
#: ../src/Doc/whatsnew/2.7.rst:355
msgid ""
"This means Python now supports three different modules for parsing command-"
"line arguments: :mod:`getopt`, :mod:`optparse`, and :mod:`argparse`. The :"
"mod:`getopt` module closely resembles the C library's :c:func:`getopt` "
"function, so it remains useful if you're writing a Python prototype that "
"will eventually be rewritten in C. :mod:`optparse` becomes redundant, but "
"there are no plans to remove it because there are many scripts still using "
"it, and there's no automated way to update these scripts. (Making the :mod:"
"`argparse` API consistent with :mod:`optparse`'s interface was discussed but "
"rejected as too messy and difficult.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:366
msgid ""
"In short, if you're writing a new script and don't need to worry about "
"compatibility with earlier versions of Python, use :mod:`argparse` instead "
"of :mod:`optparse`."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:370
msgid "Here's an example::"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:393
msgid ""
"Unless you override it, :option:`-h` and :option:`--help` switches are "
"automatically added, and produce neatly formatted output::"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:410
msgid ""
"As with :mod:`optparse`, the command-line switches and arguments are "
"returned as an object with attributes named by the *dest* parameters::"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:425
msgid ""
":mod:`argparse` has much fancier validation than :mod:`optparse`; you can "
"specify an exact number of arguments as an integer, 0 or more arguments by "
"passing ``'*'``, 1 or more by passing ``'+'``, or an optional argument with "
"``'?'``. A top-level parser can contain sub-parsers to define subcommands "
"that have different sets of switches, as in ``svn commit``, ``svn "
"checkout``, etc. You can specify an argument's type as :class:`~argparse."
"FileType`, which will automatically open files for you and understands that "
"``'-'`` means standard input or output."
msgstr ""
# 5ed6385118c747039b0c4ab71a6f166b
#: ../src/Doc/whatsnew/2.7.rst:437
msgid ":mod:`argparse` documentation"
msgstr ""
# 65dcc4cafab24c93bf812c68dd25565a
#: ../src/Doc/whatsnew/2.7.rst:438
msgid "The documentation page of the argparse module."
msgstr ""
# afbf8b937fdd48bca64f66763049e0b7
#: ../src/Doc/whatsnew/2.7.rst:441
msgid ":ref:`argparse-from-optparse`"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:441
msgid ""
"Part of the Python documentation, describing how to convert code that uses :"
"mod:`optparse`."
msgstr ""
# 3aaf011e14184676a6c054c07112f2b2
#: ../src/Doc/whatsnew/2.7.rst:443
msgid ":pep:`389` - argparse - New Command Line Parsing Module"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:445
msgid "PEP written and implemented by Steven Bethard."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:448
msgid "PEP 391: Dictionary-Based Configuration For Logging"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:450
msgid ""
"The :mod:`logging` module is very flexible; applications can define a tree "
"of logging subsystems, and each logger in this tree can filter out certain "
"messages, format them differently, and direct messages to a varying number "
"of handlers."
msgstr ""
# 63080229107c497fb3ee4944dc691876
#: ../src/Doc/whatsnew/2.7.rst:455
msgid ""
"All this flexibility can require a lot of configuration. You can write "
"Python statements to create objects and set their properties, but a complex "
"set-up requires verbose but boring code. :mod:`logging` also supports a :"
"func:`~logging.fileConfig` function that parses a file, but the file format "
"doesn't support configuring filters, and it's messier to generate "
"programmatically."
msgstr ""
# 608a8b73f2b948f19ad458c910567d3b
#: ../src/Doc/whatsnew/2.7.rst:462
msgid ""
"Python 2.7 adds a :func:`~logging.dictConfig` function that uses a "
"dictionary to configure logging. There are many ways to produce a "
"dictionary from different sources: construct one with code; parse a file "
"containing JSON; or use a YAML parsing library if one is installed. For "
"more information see :ref:`logging-config-api`."
msgstr ""
# 17302177cedd47a898d2621fbc53d11b
#: ../src/Doc/whatsnew/2.7.rst:468
msgid ""
"The following example configures two loggers, the root logger and a logger "
"named \"network\". Messages sent to the root logger will be sent to the "
"system log using the syslog protocol, and messages to the \"network\" logger "
"will be written to a :file:`network.log` file that will be rotated once the "
"log reaches 1MB."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:518
msgid ""
"Three smaller enhancements to the :mod:`logging` module, all implemented by "
"Vinay Sajip, are:"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:523
msgid ""
"The :class:`~logging.handlers.SysLogHandler` class now supports syslogging "
"over TCP. The constructor has a *socktype* parameter giving the type of "
"socket to use, either :const:`socket.SOCK_DGRAM` for UDP or :const:`socket."
"SOCK_STREAM` for TCP. The default protocol remains UDP."
msgstr ""
# 50b55474541b491fbadd97ccda8565ca
#: ../src/Doc/whatsnew/2.7.rst:529
msgid ""
":class:`~logging.Logger` instances gained a :meth:`~logging.Logger.getChild` "
"method that retrieves a descendant logger using a relative path. For "
"example, once you retrieve a logger by doing ``log = getLogger('app')``, "
"calling ``log.getChild('network.listen')`` is equivalent to ``getLogger('app."
"network.listen')``."
msgstr ""
# 615bdb031e4c454baae7d69d68ef18e3
#: ../src/Doc/whatsnew/2.7.rst:535
msgid ""
"The :class:`~logging.LoggerAdapter` class gained a :meth:`~logging."
"LoggerAdapter.isEnabledFor` method that takes a *level* and returns whether "
"the underlying logger would process a message of that level of importance."
msgstr ""
# 1c3048ec8b96441aaac5b88c14eab09a
#: ../src/Doc/whatsnew/2.7.rst:543
msgid ":pep:`391` - Dictionary-Based Configuration For Logging"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:545
msgid "PEP written and implemented by Vinay Sajip."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:548
msgid "PEP 3106: Dictionary Views"
msgstr ""
# c3cbfe42b58748f4b2ce92711f920579
#: ../src/Doc/whatsnew/2.7.rst:550
msgid ""
"The dictionary methods :meth:`~dict.keys`, :meth:`~dict.values`, and :meth:"
"`~dict.items` are different in Python 3.x. They return an object called a :"
"dfn:`view` instead of a fully materialized list."
msgstr ""
# 6de61752ed6f4357a3f58258c38f22c5
#: ../src/Doc/whatsnew/2.7.rst:554
msgid ""
"It's not possible to change the return values of :meth:`~dict.keys`, :meth:"
"`~dict.values`, and :meth:`~dict.items` in Python 2.7 because too much code "
"would break. Instead the 3.x versions were added under the new names :meth:"
"`~dict.viewkeys`, :meth:`~dict.viewvalues`, and :meth:`~dict.viewitems`."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:568
msgid ""
"Views can be iterated over, but the key and item views also behave like "
"sets. The ``&`` operator performs intersection, and ``|`` performs a union::"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:579
msgid ""
"The view keeps track of the dictionary and its contents change as the "
"dictionary is modified::"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:589
msgid ""
"However, note that you can't add or remove keys while you're iterating over "
"the view::"
msgstr ""
# acf0a68fe1134543952389c0b83fd1b2
#: ../src/Doc/whatsnew/2.7.rst:599
msgid ""
"You can use the view methods in Python 2.x code, and the 2to3 converter will "
"change them to the standard :meth:`~dict.keys`, :meth:`~dict.values`, and :"
"meth:`~dict.items` methods."
msgstr ""
# 3a5c880bbce14113aefe7186cceb2a3b
#: ../src/Doc/whatsnew/2.7.rst:605
msgid ":pep:`3106` - Revamping dict.keys(), .values() and .items()"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:606
msgid ""
"PEP written by Guido van Rossum. Backported to 2.7 by Alexandre Vassalotti; :"
"issue:`1967`."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:611
msgid "PEP 3137: The memoryview Object"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:613
msgid ""
"The :class:`memoryview` object provides a view of another object's memory "
"content that matches the :class:`bytes` type's interface."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:628
msgid ""
"The content of the view can be converted to a string of bytes or a list of "
"integers:"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:637
msgid ""
":class:`memoryview` objects allow modifying the underlying object if it's a "
"mutable object."
msgstr ""
# 133348b32b1d4f21a3adfcd4e7e26849
#: ../src/Doc/whatsnew/2.7.rst:656
msgid ":pep:`3137` - Immutable Bytes and Mutable Buffer"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:656
msgid ""
"PEP written by Guido van Rossum. Implemented by Travis Oliphant, Antoine "
"Pitrou and others. Backported to 2.7 by Antoine Pitrou; :issue:`2396`."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:667
msgid ""
"The syntax for set literals has been backported from Python 3.x. Curly "
"brackets are used to surround the contents of the resulting mutable set; set "
"literals are distinguished from dictionaries by not containing colons and "
"values. ``{}`` continues to represent an empty dictionary; use ``set()`` for "
"an empty set."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:681
msgid "Backported by Alexandre Vassalotti; :issue:`2335`."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:683
msgid ""
"Dictionary and set comprehensions are another feature backported from 3.x, "
"generalizing list/generator comprehensions to use the literal syntax for "
"sets and dictionaries."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:692
msgid "Backported by Alexandre Vassalotti; :issue:`2333`."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:694
msgid ""
"The :keyword:`with` statement can now use multiple context managers in one "
"statement. Context managers are processed from left to right and each one "
"is treated as beginning a new :keyword:`with` statement. This means that::"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:702
msgid "is equivalent to::"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:708
msgid ""
"The :func:`contextlib.nested` function provides a very similar function, so "
"it's no longer necessary and has been deprecated."
msgstr ""
# f242a9b2f2a34208805e30eb054164e3
#: ../src/Doc/whatsnew/2.7.rst:711
msgid ""
"(Proposed in https://codereview.appspot.com/53094; implemented by Georg "
"Brandl.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:714
msgid ""
"Conversions between floating-point numbers and strings are now correctly "
"rounded on most platforms. These conversions occur in many different "
"places: :func:`str` on floats and complex numbers; the :class:`float` and :"
"class:`complex` constructors; numeric formatting; serializing and "
"deserializing floats and complex numbers using the :mod:`marshal`, :mod:"
"`pickle` and :mod:`json` modules; parsing of float and imaginary literals in "
"Python code; and :class:`~decimal.Decimal`-to-float conversion."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:726
msgid ""
"Related to this, the :func:`repr` of a floating-point number *x* now returns "
"a result based on the shortest decimal string that's guaranteed to round "
"back to *x* under correct rounding (with round-half-to-even rounding mode). "
"Previously it gave a string based on rounding x to 17 decimal digits."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:734
msgid ""
"The rounding library responsible for this improvement works on Windows and "
"on Unix platforms using the gcc, icc, or suncc compilers. There may be a "
"small number of platforms where correct operation of this code cannot be "
"guaranteed, so the code is not used on such systems. You can find out which "
"code is being used by checking :data:`sys.float_repr_style`, which will be "
"``short`` if the new code is in use and ``legacy`` if it isn't."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:742
msgid ""
"Implemented by Eric Smith and Mark Dickinson, using David Gay's :file:`dtoa."
"c` library; :issue:`7117`."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:745
msgid ""
"Conversions from long integers and regular integers to floating point now "
"round differently, returning the floating-point number closest to the "
"number. This doesn't matter for small integers that can be converted "
"exactly, but for large numbers that will unavoidably lose precision, Python "
"2.7 now approximates more closely. For example, Python 2.6 computed the "
"following::"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:758
msgid ""
"Python 2.7's floating-point result is larger, but much closer to the true "
"value::"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:767
msgid "(Implemented by Mark Dickinson; :issue:`3166`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:769
msgid ""
"Integer division is also more accurate in its rounding behaviours. (Also "
"implemented by Mark Dickinson; :issue:`1811`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:772
msgid ""
"Implicit coercion for complex numbers has been removed; the interpreter will "
"no longer ever attempt to call a :meth:`__coerce__` method on complex "
"objects. (Removed by Meador Inge and Mark Dickinson; :issue:`5211`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:776
msgid ""
"The :meth:`str.format` method now supports automatic numbering of the "
"replacement fields. This makes using :meth:`str.format` more closely "
"resemble using ``%s`` formatting::"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:785
msgid ""
"The auto-numbering takes the fields from left to right, so the first ``{...}"
"`` specifier will use the first argument to :meth:`str.format`, the next "
"specifier will use the next argument, and so on. You can't mix auto-"
"numbering and explicit numbering -- either number all of your specifier "
"fields or none of them -- but you can mix auto-numbering and named fields, "
"as in the second example above. (Contributed by Eric Smith; :issue:`5237`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:792
msgid ""
"Complex numbers now correctly support usage with :func:`format`, and default "
"to being right-aligned. Specifying a precision or comma-separation applies "
"to both the real and imaginary parts of the number, but a specified field "
"width and alignment is applied to the whole of the resulting ``1.5+3j`` "
"output. (Contributed by Eric Smith; :issue:`1588` and :issue:`7988`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:799
msgid ""
"The 'F' format code now always formats its output using uppercase "
"characters, so it will now produce 'INF' and 'NAN'. (Contributed by Eric "
"Smith; :issue:`3382`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:803
msgid ""
"A low-level change: the :meth:`object.__format__` method now triggers a :exc:"
"`PendingDeprecationWarning` if it's passed a format string, because the :"
"meth:`__format__` method for :class:`object` converts the object to a string "
"representation and formats that. Previously the method silently applied the "
"format string to the string representation, but that could hide mistakes in "
"Python code. If you're supplying formatting information such as an "
"alignment or precision, presumably you're expecting the formatting to be "
"applied in some object-specific way. (Fixed by Eric Smith; :issue:`7994`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:813
msgid ""
"The :func:`int` and :func:`long` types gained a ``bit_length`` method that "
"returns the number of bits necessary to represent its argument in binary::"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:828
msgid "(Contributed by Fredrik Johansson and Victor Stinner; :issue:`3439`.)"
msgstr ""
# 336ab7fe57d54f0189837aef68d85d98
#: ../src/Doc/whatsnew/2.7.rst:830
msgid ""
"The :keyword:`import` statement will no longer try an absolute import if a "
"relative import (e.g. ``from .os import sep``) fails. This fixes a bug, but "
"could possibly break certain :keyword:`import` statements that were only "
"working by accident. (Fixed by Meador Inge; :issue:`7902`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:836
msgid ""
"It's now possible for a subclass of the built-in :class:`unicode` type to "
"override the :meth:`__unicode__` method. (Implemented by Victor Stinner; :"
"issue:`1583863`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:840
msgid ""
"The :class:`bytearray` type's :meth:`~bytearray.translate` method now "
"accepts ``None`` as its first argument. (Fixed by Georg Brandl; :issue:"
"`4759`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:846
msgid ""
"When using ``@classmethod`` and ``@staticmethod`` to wrap methods as class "
"or static methods, the wrapper object now exposes the wrapped function as "
"their :attr:`__func__` attribute. (Contributed by Amaury Forgeot d'Arc, "
"after a suggestion by George Sakkis; :issue:`5982`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:852 ../src/Doc/whatsnew/2.7.rst:2424
msgid ""
"When a restricted set of attributes were set using ``__slots__``, deleting "
"an unset attribute would not raise :exc:`AttributeError` as you would "
"expect. Fixed by Benjamin Peterson; :issue:`7604`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:856
msgid ""
"Two new encodings are now supported: \"cp720\", used primarily for Arabic "
"text; and \"cp858\", a variant of CP 850 that adds the euro symbol. (CP720 "
"contributed by Alexander Belchenko and Amaury Forgeot d'Arc in :issue:"
"`1616979`; CP858 contributed by Tim Hatch in :issue:`8016`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:862
msgid ""
"The :class:`file` object will now set the :attr:`filename` attribute on the :"
"exc:`IOError` exception when trying to open a directory on POSIX platforms "
"(noted by Jan Kaliszewski; :issue:`4764`), and now explicitly checks for and "
"forbids writing to read-only file objects instead of trusting the C library "
"to catch and report the error (fixed by Stefan Krah; :issue:`5677`)."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:869
msgid ""
"The Python tokenizer now translates line endings itself, so the :func:"
"`compile` built-in function now accepts code using any line-ending "
"convention. Additionally, it no longer requires that the code end in a "
"newline."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:874
msgid ""
"Extra parentheses in function definitions are illegal in Python 3.x, meaning "
"that you get a syntax error from ``def f((x)): pass``. In Python3-warning "
"mode, Python 2.7 will now warn about this odd usage. (Noted by James "
"Lingard; :issue:`7362`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:879
msgid ""
"It's now possible to create weak references to old-style class objects. New-"
"style classes were always weak-referenceable. (Fixed by Antoine Pitrou; :"
"issue:`8268`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:883
msgid ""
"When a module object is garbage-collected, the module's dictionary is now "
"only cleared if no one else is holding a reference to the dictionary (:issue:"
"`7140`)."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:894
msgid ""
"A new environment variable, :envvar:`PYTHONWARNINGS`, allows controlling "
"warnings. It should be set to a string containing warning settings, "
"equivalent to those used with the :option:`-W` switch, separated by commas. "
"(Contributed by Brian Curtin; :issue:`7301`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:900
msgid ""
"For example, the following setting will print warnings every time they "
"occur, but turn warnings from the :mod:`Cookie` module into an error. (The "
"exact syntax for setting an environment variable varies across operating "
"systems and shells.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:915
msgid "Several performance enhancements have been added:"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:917
msgid ""
"A new opcode was added to perform the initial setup for :keyword:`with` "
"statements, looking up the :meth:`__enter__` and :meth:`__exit__` methods. "
"(Contributed by Benjamin Peterson.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:921
msgid ""
"The garbage collector now performs better for one common usage pattern: when "
"many objects are being allocated without deallocating any of them. This "
"would previously take quadratic time for garbage collection, but now the "
"number of full garbage collections is reduced as the number of objects on "
"the heap grows. The new logic only performs a full garbage collection pass "
"when the middle generation has been collected 10 times and when the number "
"of survivor objects from the middle generation exceeds 10% of the number of "
"objects in the oldest generation. (Suggested by Martin von Löwis and "
"implemented by Antoine Pitrou; :issue:`4074`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:932
msgid ""
"The garbage collector tries to avoid tracking simple containers which can't "
"be part of a cycle. In Python 2.7, this is now true for tuples and dicts "
"containing atomic types (such as ints, strings, etc.). Transitively, a dict "
"containing tuples of atomic types won't be tracked either. This helps reduce "
"the cost of each garbage collection by decreasing the number of objects to "
"be considered and traversed by the collector. (Contributed by Antoine "
"Pitrou; :issue:`4688`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:941
msgid ""
"Long integers are now stored internally either in base 2**15 or in base "
"2**30, the base being determined at build time. Previously, they were "
"always stored in base 2**15. Using base 2**30 gives significant performance "
"improvements on 64-bit machines, but benchmark results on 32-bit machines "
"have been mixed. Therefore, the default is to use base 2**30 on 64-bit "
"machines and base 2**15 on 32-bit machines; on Unix, there's a new configure "
"option :option:`--enable-big-digits` that can be used to override this "
"default."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:950
msgid ""
"Apart from the performance improvements this change should be invisible to "
"end users, with one exception: for testing and debugging purposes there's a "
"new structseq :data:`sys.long_info` that provides information about the "
"internal format, giving the number of bits per digit and the size in bytes "
"of the C type used to store each digit::"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:961
msgid "(Contributed by Mark Dickinson; :issue:`4258`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:963
msgid ""
"Another set of changes made long objects a few bytes smaller: 2 bytes "
"smaller on 32-bit systems and 6 bytes on 64-bit. (Contributed by Mark "
"Dickinson; :issue:`5260`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:967
msgid ""
"The division algorithm for long integers has been made faster by tightening "
"the inner loop, doing shifts instead of multiplications, and fixing an "
"unnecessary extra iteration. Various benchmarks show speedups of between 50% "
"and 150% for long integer divisions and modulo operations. (Contributed by "
"Mark Dickinson; :issue:`5512`.) Bitwise operations are also significantly "
"faster (initial patch by Gregory Smith; :issue:`1087418`)."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:976
msgid ""
"The implementation of ``%`` checks for the left-side operand being a Python "
"string and special-cases it; this results in a 1-3% performance increase for "
"applications that frequently use ``%`` with strings, such as templating "
"libraries. (Implemented by Collin Winter; :issue:`5176`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:982
msgid ""
"List comprehensions with an ``if`` condition are compiled into faster "
"bytecode. (Patch by Antoine Pitrou, back-ported to 2.7 by Jeffrey Yasskin; :"
"issue:`4715`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:986
msgid ""
"Converting an integer or long integer to a decimal string was made faster by "
"special-casing base 10 instead of using a generalized conversion function "
"that supports arbitrary bases. (Patch by Gawain Bolton; :issue:`6713`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:991
msgid ""
"The :meth:`split`, :meth:`replace`, :meth:`rindex`, :meth:`rpartition`, and :"
"meth:`rsplit` methods of string-like types (strings, Unicode strings, and :"
"class:`bytearray` objects) now use a fast reverse-search algorithm instead "
"of a character-by-character scan. This is sometimes faster by a factor of "
"10. (Added by Florent Xicluna; :issue:`7462` and :issue:`7622`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:998
msgid ""
"The :mod:`pickle` and :mod:`cPickle` modules now automatically intern the "
"strings used for attribute names, reducing memory usage of the objects "
"resulting from unpickling. (Contributed by Jake McGuire; :issue:`5084`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1003
msgid ""
"The :mod:`cPickle` module now special-cases dictionaries, nearly halving the "
"time required to pickle them. (Contributed by Collin Winter; :issue:`5670`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1018
msgid ""
"The :mod:`bdb` module's base debugging class :class:`~bdb.Bdb` gained a "
"feature for skipping modules. The constructor now takes an iterable "
"containing glob-style patterns such as ``django.*``; the debugger will not "
"step into stack frames from a module that matches one of these patterns. "
"(Contributed by Maru Newby after a suggestion by Senthil Kumaran; :issue:"
"`5142`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1026
msgid ""
"The :mod:`binascii` module now supports the buffer API, so it can be used "
"with :class:`memoryview` instances and other similar buffer objects. "
"(Backported from 3.x by Florent Xicluna; :issue:`7703`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1030
msgid ""
"Updated module: the :mod:`bsddb` module has been updated from 4.7.2devel9 to "
"version 4.8.4 of `the pybsddb package <http://www.jcea.es/programacion/"
"pybsddb.htm>`__. The new version features better Python 3.x compatibility, "
"various bug fixes, and adds several new BerkeleyDB flags and methods. "
"(Updated by Jesús Cea Avión; :issue:`8156`. The pybsddb changelog can be "
"read at http://hg.jcea.es/pybsddb/file/tip/ChangeLog.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1038
msgid ""
"The :mod:`bz2` module's :class:`~bz2.BZ2File` now supports the context "
"management protocol, so you can write ``with bz2.BZ2File(...) as f:``. "
"(Contributed by Hagen Fürstenau; :issue:`3860`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1042
msgid ""
"New class: the :class:`~collections.Counter` class in the :mod:`collections` "
"module is useful for tallying data. :class:`~collections.Counter` instances "
"behave mostly like dictionaries but return zero for missing keys instead of "
"raising a :exc:`KeyError`:"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1064
msgid ""
"There are three additional :class:`~collections.Counter` methods. :meth:"
"`~collections.Counter.most_common` returns the N most common elements and "
"their counts. :meth:`~collections.Counter.elements` returns an iterator "
"over the contained elements, repeating each element as many times as its "
"count. :meth:`~collections.Counter.subtract` takes an iterable and subtracts "
"one for each element instead of adding; if the argument is a dictionary or "
"another :class:`Counter`, the counts are subtracted. ::"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1087
msgid "Contributed by Raymond Hettinger; :issue:`1696199`."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1091
msgid ""
"New class: :class:`~collections.OrderedDict` is described in the earlier "
"section :ref:`pep-0372`."
msgstr ""
# 547cb69002064e1d94f637ac6aa69e41
#: ../src/Doc/whatsnew/2.7.rst:1094
msgid ""
"New method: The :class:`~collections.deque` data type now has a :meth:"
"`~collections.deque.count` method that returns the number of contained "
"elements equal to the supplied argument *x*, and a :meth:`~collections.deque."
"reverse` method that reverses the elements of the deque in-place. :class:"
"`~collections.deque` also exposes its maximum length as the read-only :attr:"
"`~collections.deque.maxlen` attribute. (Both features added by Raymond "
"Hettinger.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1102
msgid ""
"The :class:`~collections.namedtuple` class now has an optional *rename* "
"parameter. If *rename* is true, field names that are invalid because they've "
"been repeated or aren't legal Python identifiers will be renamed to legal "
"names that are derived from the field's position within the list of fields:"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1113
msgid "(Added by Raymond Hettinger; :issue:`1818`.)"
msgstr ""
# a85f3a96e9a647e7b9b42ca0199f154f
#: ../src/Doc/whatsnew/2.7.rst:1115
msgid ""
"Finally, the :class:`~collections.Mapping` abstract base class now returns :"
"const:`NotImplemented` if a mapping is compared to another type that isn't "
"a :class:`Mapping`. (Fixed by Daniel Stutzbach; :issue:`8729`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1120
msgid ""
"Constructors for the parsing classes in the :mod:`ConfigParser` module now "
"take a *allow_no_value* parameter, defaulting to false; if true, options "
"without values will be allowed. For example::"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1142
msgid "(Contributed by Mats Kindahl; :issue:`7005`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1144
msgid ""
"Deprecated function: :func:`contextlib.nested`, which allows handling more "
"than one context manager with a single :keyword:`with` statement, has been "
"deprecated, because the :keyword:`with` statement now supports multiple "
"context managers."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1149
msgid ""
"The :mod:`cookielib` module now ignores cookies that have an invalid version "
"field, one that doesn't contain an integer value. (Fixed by John J. Lee; :"
"issue:`3924`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1153
msgid ""
"The :mod:`copy` module's :func:`~copy.deepcopy` function will now correctly "
"copy bound instance methods. (Implemented by Robert Collins; :issue:`1515`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1157
msgid ""
"The :mod:`ctypes` module now always converts ``None`` to a C NULL pointer "
"for arguments declared as pointers. (Changed by Thomas Heller; :issue:"
"`4606`.) The underlying `libffi library <http://sourceware.org/libffi/>`__ "
"has been updated to version 3.0.9, containing various fixes for different "
"platforms. (Updated by Matthias Klose; :issue:`8142`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1164
msgid ""
"New method: the :mod:`datetime` module's :class:`~datetime.timedelta` class "
"gained a :meth:`~datetime.timedelta.total_seconds` method that returns the "
"number of seconds in the duration. (Contributed by Brian Quinlan; :issue:"
"`5788`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1168
msgid ""
"New method: the :class:`~decimal.Decimal` class gained a :meth:`~decimal."
"Decimal.from_float` class method that performs an exact conversion of a "
"floating-point number to a :class:`~decimal.Decimal`. This exact conversion "
"strives for the closest decimal approximation to the floating-point "
"representation's value; the resulting decimal value will therefore still "
"include the inaccuracy, if any. For example, ``Decimal.from_float(0.1)`` "
"returns "
"``Decimal('0.1000000000000000055511151231257827021181583404541015625')``. "
"(Implemented by Raymond Hettinger; :issue:`4796`.)"
msgstr ""
# 59c6ac1cf7be477cab84ac2ce58975bb
#: ../src/Doc/whatsnew/2.7.rst:1179
msgid ""
"Comparing instances of :class:`~decimal.Decimal` with floating-point numbers "
"now produces sensible results based on the numeric values of the operands. "
"Previously such comparisons would fall back to Python's default rules for "
"comparing objects, which produced arbitrary results based on their type. "
"Note that you still cannot combine :class:`Decimal` and floating-point in "
"other operations such as addition, since you should be explicitly choosing "
"how to convert between float and :class:`~decimal.Decimal`. (Fixed by Mark "
"Dickinson; :issue:`2531`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1188
msgid ""
"The constructor for :class:`~decimal.Decimal` now accepts floating-point "
"numbers (added by Raymond Hettinger; :issue:`8257`) and non-European Unicode "
"characters such as Arabic-Indic digits (contributed by Mark Dickinson; :"
"issue:`6595`)."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1193
msgid ""
"Most of the methods of the :class:`~decimal.Context` class now accept "
"integers as well as :class:`~decimal.Decimal` instances; the only exceptions "
"are the :meth:`~decimal.Context.canonical` and :meth:`~decimal.Context."
"is_canonical` methods. (Patch by Juan José Conti; :issue:`7633`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1198
msgid ""
"When using :class:`~decimal.Decimal` instances with a string's :meth:`~str."
"format` method, the default alignment was previously left-alignment. This "
"has been changed to right-alignment, which is more sensible for numeric "
"types. (Changed by Mark Dickinson; :issue:`6857`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1203
msgid ""
"Comparisons involving a signaling NaN value (or ``sNAN``) now signal :const:"
"`InvalidOperation` instead of silently returning a true or false value "
"depending on the comparison operator. Quiet NaN values (or ``NaN``) are now "
"hashable. (Fixed by Mark Dickinson; :issue:`7279`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1209
msgid ""
"The :mod:`difflib` module now produces output that is more compatible with "
"modern :command:`diff`/:command:`patch` tools through one small change, "
"using a tab character instead of spaces as a separator in the header giving "
"the filename. (Fixed by Anatoly Techtonik; :issue:`7585`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1215
msgid ""
"The Distutils ``sdist`` command now always regenerates the :file:`MANIFEST` "
"file, since even if the :file:`MANIFEST.in` or :file:`setup.py` files "
"haven't been modified, the user might have created some new files that "
"should be included. (Fixed by Tarek Ziadé; :issue:`8688`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1221
msgid ""
"The :mod:`doctest` module's :const:`IGNORE_EXCEPTION_DETAIL` flag will now "
"ignore the name of the module containing the exception being tested. (Patch "
"by Lennart Regebro; :issue:`7490`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1225
msgid ""
"The :mod:`email` module's :class:`~email.message.Message` class will now "
"accept a Unicode-valued payload, automatically converting the payload to the "
"encoding specified by :attr:`output_charset`. (Added by R. David Murray; :"
"issue:`1368247`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1230
msgid ""
"The :class:`~fractions.Fraction` class now accepts a single float or :class:"
"`~decimal.Decimal` instance, or two rational numbers, as arguments to its "
"constructor. (Implemented by Mark Dickinson; rationals added in :issue:"
"`5812`, and float/decimal in :issue:`8294`.)"
msgstr ""
# b290216926fe41ae9561bf5d57aac712
#: ../src/Doc/whatsnew/2.7.rst:1236
msgid ""
"Ordering comparisons (``<``, ``<=``, ``>``, ``>=``) between fractions and "
"complex numbers now raise a :exc:`TypeError`. This fixes an oversight, "
"making the :class:`~fractions.Fraction` match the other numeric types."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1243
msgid ""
"New class: :class:`~ftplib.FTP_TLS` in the :mod:`ftplib` module provides "
"secure FTP connections using TLS encapsulation of authentication as well as "
"subsequent control and data transfers. (Contributed by Giampaolo Rodola; :"
"issue:`2054`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1249
msgid ""
"The :meth:`~ftplib.FTP.storbinary` method for binary uploads can now restart "
"uploads thanks to an added *rest* parameter (patch by Pablo Mouzo; :issue:"
"`6845`.)"
msgstr ""
# d11eef387aae45de9976bce0674df2bb
#: ../src/Doc/whatsnew/2.7.rst:1253
msgid ""
"New class decorator: :func:`~functools.total_ordering` in the :mod:"
"`functools` module takes a class that defines an :meth:`__eq__` method and "
"one of :meth:`__lt__`, :meth:`__le__`, :meth:`__gt__`, or :meth:`__ge__`, "
"and generates the missing comparison methods. Since the :meth:`__cmp__` "
"method is being deprecated in Python 3.x, this decorator makes it easier to "
"define ordered classes. (Added by Raymond Hettinger; :issue:`5479`.)"
msgstr ""
# 4433348cb6aa411b8da223a529f5316c
#: ../src/Doc/whatsnew/2.7.rst:1261
msgid ""
"New function: :func:`~functools.cmp_to_key` will take an old-style "
"comparison function that expects two arguments and return a new callable "
"that can be used as the *key* parameter to functions such as :func:"
"`sorted`, :func:`min` and :func:`max`, etc. The primary intended use is to "
"help with making code compatible with Python 3.x. (Added by Raymond "
"Hettinger.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1268
msgid ""
"New function: the :mod:`gc` module's :func:`~gc.is_tracked` returns true if "
"a given instance is tracked by the garbage collector, false otherwise. "
"(Contributed by Antoine Pitrou; :issue:`4688`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1272
msgid ""
"The :mod:`gzip` module's :class:`~gzip.GzipFile` now supports the context "
"management protocol, so you can write ``with gzip.GzipFile(...) as f:`` "
"(contributed by Hagen Fürstenau; :issue:`3860`), and it now implements the :"
"class:`io.BufferedIOBase` ABC, so you can wrap it with :class:`io."
"BufferedReader` for faster processing (contributed by Nir Aides; :issue:"
"`7471`). It's also now possible to override the modification time recorded "
"in a gzipped file by providing an optional timestamp to the constructor. "
"(Contributed by Jacques Frechet; :issue:`4272`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1282
msgid ""
"Files in gzip format can be padded with trailing zero bytes; the :mod:`gzip` "
"module will now consume these trailing bytes. (Fixed by Tadek Pietraszek "
"and Brian Curtin; :issue:`2846`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1286
msgid ""
"New attribute: the :mod:`hashlib` module now has an :attr:`~hashlib.hashlib."
"algorithms` attribute containing a tuple naming the supported algorithms. In "
"Python 2.7, ``hashlib.algorithms`` contains ``('md5', 'sha1', 'sha224', "
"'sha256', 'sha384', 'sha512')``. (Contributed by Carl Chenet; :issue:`7418`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1292
msgid ""
"The default :class:`~httplib.HTTPResponse` class used by the :mod:`httplib` "
"module now supports buffering, resulting in much faster reading of HTTP "
"responses. (Contributed by Kristján Valur Jónsson; :issue:`4879`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1296
msgid ""
"The :class:`~httplib.HTTPConnection` and :class:`~httplib.HTTPSConnection` "
"classes now support a *source_address* parameter, a ``(host, port)`` 2-tuple "
"giving the source address that will be used for the connection. (Contributed "
"by Eldon Ziegler; :issue:`3972`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1301
msgid ""
"The :mod:`ihooks` module now supports relative imports. Note that :mod:"
"`ihooks` is an older module for customizing imports, superseded by the :mod:"
"`imputil` module added in Python 2.0. (Relative import support added by Neil "
"Schemenauer.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1308
msgid ""
"The :mod:`imaplib` module now supports IPv6 addresses. (Contributed by Derek "
"Morr; :issue:`1655`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1311
msgid ""
"New function: the :mod:`inspect` module's :func:`~inspect.getcallargs` takes "
"a callable and its positional and keyword arguments, and figures out which "
"of the callable's parameters will receive each argument, returning a "
"dictionary mapping argument names to their values. For example::"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1328
msgid "Contributed by George Sakkis; :issue:`3135`."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1330
msgid ""
"Updated module: The :mod:`io` library has been upgraded to the version "
"shipped with Python 3.1. For 3.1, the I/O library was entirely rewritten in "
"C and is 2 to 20 times faster depending on the task being performed. The "
"original Python version was renamed to the :mod:`_pyio` module."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1335
msgid ""
"One minor resulting change: the :class:`io.TextIOBase` class now has an :"
"attr:`errors` attribute giving the error setting used for encoding and "
"decoding errors (one of ``'strict'``, ``'replace'``, ``'ignore'``)."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1340
msgid ""
"The :class:`io.FileIO` class now raises an :exc:`OSError` when passed an "
"invalid file descriptor. (Implemented by Benjamin Peterson; :issue:"
"`4991`.) The :meth:`~io.IOBase.truncate` method now preserves the file "
"position; previously it would change the file position to the end of the new "
"file. (Fixed by Pascal Chambon; :issue:`6939`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1346
msgid ""
"New function: ``itertools.compress(data, selectors)`` takes two iterators. "
"Elements of *data* are returned if the corresponding value in *selectors* is "
"true::"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1355
msgid ""
"New function: ``itertools.combinations_with_replacement(iter, r)`` returns "
"all the possible *r*-length combinations of elements from the iterable "
"*iter*. Unlike :func:`~itertools.combinations`, individual elements can be "
"repeated in the generated combinations::"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1364
msgid ""
"Note that elements are treated as unique depending on their position in the "
"input, not their actual values."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1367
msgid ""
"The :func:`itertools.count` function now has a *step* argument that allows "
"incrementing by values other than 1. :func:`~itertools.count` also now "
"allows keyword arguments, and using non-integer values such as floats or :"
"class:`~decimal.Decimal` instances. (Implemented by Raymond Hettinger; :"
"issue:`5032`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1373
msgid ""
":func:`itertools.combinations` and :func:`itertools.product` previously "
"raised :exc:`ValueError` for values of *r* larger than the input iterable. "
"This was deemed a specification error, so they now return an empty "
"iterator. (Fixed by Raymond Hettinger; :issue:`4816`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1378
msgid ""
"Updated module: The :mod:`json` module was upgraded to version 2.0.9 of the "
"simplejson package, which includes a C extension that makes encoding and "
"decoding faster. (Contributed by Bob Ippolito; :issue:`4136`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1383
msgid ""
"To support the new :class:`collections.OrderedDict` type, :func:`json.load` "
"now has an optional *object_pairs_hook* parameter that will be called with "
"any object literal that decodes to a list of pairs. (Contributed by Raymond "
"Hettinger; :issue:`5381`.)"
msgstr ""
# de7384bd02bd4a6ca8611c5f7e76de9e
#: ../src/Doc/whatsnew/2.7.rst:1388
msgid ""
"The :mod:`mailbox` module's :class:`~mailbox.Maildir` class now records the "
"timestamp on the directories it reads, and only re-reads them if the "
"modification time has subsequently changed. This improves performance by "
"avoiding unneeded directory scans. (Fixed by A.M. Kuchling and Antoine "
"Pitrou; :issue:`1607951`, :issue:`6896`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1394
msgid ""
"New functions: the :mod:`math` module gained :func:`~math.erf` and :func:"
"`~math.erfc` for the error function and the complementary error function, :"
"func:`~math.expm1` which computes ``e**x - 1`` with more precision than "
"using :func:`~math.exp` and subtracting 1, :func:`~math.gamma` for the Gamma "
"function, and :func:`~math.lgamma` for the natural log of the Gamma "
"function. (Contributed by Mark Dickinson and nirinA raseliarison; :issue:"
"`3366`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1402
msgid ""
"The :mod:`multiprocessing` module's :class:`Manager*` classes can now be "
"passed a callable that will be called whenever a subprocess is started, "
"along with a set of arguments that will be passed to the callable. "
"(Contributed by lekma; :issue:`5585`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1408
msgid ""
"The :class:`~multiprocessing.Pool` class, which controls a pool of worker "
"processes, now has an optional *maxtasksperchild* parameter. Worker "
"processes will perform the specified number of tasks and then exit, causing "
"the :class:`~multiprocessing.Pool` to start a new worker. This is useful if "
"tasks may leak memory or other resources, or if some tasks will cause the "
"worker to become very large. (Contributed by Charles Cazabon; :issue:`6963`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1416
msgid ""
"The :mod:`nntplib` module now supports IPv6 addresses. (Contributed by Derek "
"Morr; :issue:`1664`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1419
msgid ""
"New functions: the :mod:`os` module wraps the following POSIX system calls: :"
"func:`~os.getresgid` and :func:`~os.getresuid`, which return the real, "
"effective, and saved GIDs and UIDs; :func:`~os.setresgid` and :func:`~os."
"setresuid`, which set real, effective, and saved GIDs and UIDs to new "
"values; :func:`~os.initgroups`, which initialize the group access list for "
"the current process. (GID/UID functions contributed by Travis H.; :issue:"
"`6508`. Support for initgroups added by Jean-Paul Calderone; :issue:`7333`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1429
msgid ""
"The :func:`os.fork` function now re-initializes the import lock in the child "
"process; this fixes problems on Solaris when :func:`~os.fork` is called from "
"a thread. (Fixed by Zsolt Cserna; :issue:`7242`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1433
msgid ""
"In the :mod:`os.path` module, the :func:`~os.path.normpath` and :func:`~os."
"path.abspath` functions now preserve Unicode; if their input path is a "
"Unicode string, the return value is also a Unicode string. (:meth:`~os.path."
"normpath` fixed by Matt Giuca in :issue:`5827`; :meth:`~os.path.abspath` "
"fixed by Ezio Melotti in :issue:`3426`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1439
msgid ""
"The :mod:`pydoc` module now has help for the various symbols that Python "
"uses. You can now do ``help('<<')`` or ``help('@')``, for example. "
"(Contributed by David Laban; :issue:`4739`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1443
msgid ""
"The :mod:`re` module's :func:`~re.split`, :func:`~re.sub`, and :func:`~re."
"subn` now accept an optional *flags* argument, for consistency with the "
"other functions in the module. (Added by Gregory P. Smith.)"
msgstr ""
# 078fe0731dd24fbd8873c1c425194573
#: ../src/Doc/whatsnew/2.7.rst:1447
msgid ""
"New function: :func:`~runpy.run_path` in the :mod:`runpy` module will "
"execute the code at a provided *path* argument. *path* can be the path of a "
"Python source file (:file:`example.py`), a compiled bytecode file (:file:"
"`example.pyc`), a directory (:file:`./package/`), or a zip archive (:file:"
"`example.zip`). If a directory or zip path is provided, it will be added to "
"the front of ``sys.path`` and the module :mod:`__main__` will be imported. "
"It's expected that the directory or zip contains a :file:`__main__.py`; if "
"it doesn't, some other :file:`__main__.py` might be imported from a location "
"later in ``sys.path``. This makes more of the machinery of :mod:`runpy` "
"available to scripts that want to mimic the way Python's command line "
"processes an explicit path name. (Added by Nick Coghlan; :issue:`6816`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1461
msgid ""
"New function: in the :mod:`shutil` module, :func:`~shutil.make_archive` "
"takes a filename, archive type (zip or tar-format), and a directory path, "
"and creates an archive containing the directory's contents. (Added by Tarek "
"Ziadé.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1466
msgid ""
":mod:`shutil`'s :func:`~shutil.copyfile` and :func:`~shutil.copytree` "
"functions now raise a :exc:`~shutil.SpecialFileError` exception when asked "
"to copy a named pipe. Previously the code would treat named pipes like a "
"regular file by opening them for reading, and this would block "
"indefinitely. (Fixed by Antoine Pitrou; :issue:`3002`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1472
msgid ""
"The :mod:`signal` module no longer re-installs the signal handler unless "
"this is truly necessary, which fixes a bug that could make it impossible to "
"catch the EINTR signal robustly. (Fixed by Charles-Francois Natali; :issue:"
"`8354`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1477
msgid ""
"New functions: in the :mod:`site` module, three new functions return various "
"site- and user-specific paths. :func:`~site.getsitepackages` returns a list "
"containing all global site-packages directories, :func:`~site."
"getusersitepackages` returns the path of the user's site-packages directory, "
"and :func:`~site.getuserbase` returns the value of the :envvar:`USER_BASE` "
"environment variable, giving the path to a directory that can be used to "
"store data. (Contributed by Tarek Ziadé; :issue:`6693`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1488
msgid ""
"The :mod:`site` module now reports exceptions occurring when the :mod:"
"`sitecustomize` module is imported, and will no longer catch and swallow "
"the :exc:`KeyboardInterrupt` exception. (Fixed by Victor Stinner; :issue:"
"`3137`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1493
msgid ""
"The :func:`~socket.create_connection` function gained a *source_address* "
"parameter, a ``(host, port)`` 2-tuple giving the source address that will be "
"used for the connection. (Contributed by Eldon Ziegler; :issue:`3972`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1498
msgid ""
"The :meth:`~socket.socket.recv_into` and :meth:`~socket.socket."
"recvfrom_into` methods will now write into objects that support the buffer "
"API, most usefully the :class:`bytearray` and :class:`memoryview` objects. "
"(Implemented by Antoine Pitrou; :issue:`8104`.)"
msgstr ""
# 8e18dbe840534dffb551e63fad7982f5
#: ../src/Doc/whatsnew/2.7.rst:1503
msgid ""
"The :mod:`SocketServer` module's :class:`~SocketServer.TCPServer` class now "
"supports socket timeouts and disabling the Nagle algorithm. The :attr:"
"`~SocketServer.TCPServer.disable_nagle_algorithm` class attribute defaults "
"to False; if overridden to be True, new request connections will have the "
"TCP_NODELAY option set to prevent buffering many small sends into a single "
"TCP packet. The :attr:`~SocketServer.BaseServer.timeout` class attribute can "
"hold a timeout in seconds that will be applied to the request socket; if no "
"request is received within that time, :meth:`~SocketServer.BaseServer."
"handle_timeout` will be called and :meth:`~SocketServer.BaseServer."
"handle_request` will return. (Contributed by Kristján Valur Jónsson; :issue:"
"`6192` and :issue:`6267`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1515
msgid ""
"Updated module: the :mod:`sqlite3` module has been updated to version 2.6.0 "
"of the `pysqlite package <http://code.google.com/p/pysqlite/>`__. Version "
"2.6.0 includes a number of bugfixes, and adds the ability to load SQLite "
"extensions from shared libraries. Call the ``enable_load_extension(True)`` "
"method to enable extensions, and then call :meth:`~sqlite3.Connection."
"load_extension` to load a particular shared library. (Updated by Gerhard "
"Häring.)"
msgstr ""
# 6b4571f302574564935c99fd6fef589e
#: ../src/Doc/whatsnew/2.7.rst:1522
msgid ""
"The :mod:`ssl` module's :class:`~ssl.SSLSocket` objects now support the "
"buffer API, which fixed a test suite failure (fix by Antoine Pitrou; :issue:"
"`7133`) and automatically set OpenSSL's :c:macro:`SSL_MODE_AUTO_RETRY`, "
"which will prevent an error code being returned from :meth:`recv` operations "
"that trigger an SSL renegotiation (fix by Antoine Pitrou; :issue:`8222`)."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1529
msgid ""
"The :func:`ssl.wrap_socket` constructor function now takes a *ciphers* "
"argument that's a string listing the encryption algorithms to be allowed; "
"the format of the string is described `in the OpenSSL documentation <http://"
"www.openssl.org/docs/apps/ciphers.html#CIPHER_LIST_FORMAT>`__. (Added by "
"Antoine Pitrou; :issue:`8322`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1536
msgid ""
"Another change makes the extension load all of OpenSSL's ciphers and digest "
"algorithms so that they're all available. Some SSL certificates couldn't be "
"verified, reporting an \"unknown algorithm\" error. (Reported by Beda "
"Kosata, and fixed by Antoine Pitrou; :issue:`8484`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1542
msgid ""
"The version of OpenSSL being used is now available as the module attributes :"
"data:`ssl.OPENSSL_VERSION` (a string), :data:`ssl.OPENSSL_VERSION_INFO` (a 5-"
"tuple), and :data:`ssl.OPENSSL_VERSION_NUMBER` (an integer). (Added by "
"Antoine Pitrou; :issue:`8321`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1548
msgid ""
"The :mod:`struct` module will no longer silently ignore overflow errors when "
"a value is too large for a particular integer format code (one of "
"``bBhHiIlLqQ``); it now always raises a :exc:`struct.error` exception. "
"(Changed by Mark Dickinson; :issue:`1523`.) The :func:`~struct.pack` "
"function will also attempt to use :meth:`__index__` to convert and pack non-"
"integers before trying the :meth:`__int__` method or reporting an error. "
"(Changed by Mark Dickinson; :issue:`8300`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1557
msgid ""
"New function: the :mod:`subprocess` module's :func:`~subprocess."
"check_output` runs a command with a specified set of arguments and returns "
"the command's output as a string when the command runs without error, or "
"raises a :exc:`~subprocess.CalledProcessError` exception otherwise."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1572
msgid "(Contributed by Gregory P. Smith.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1574
msgid ""
"The :mod:`subprocess` module will now retry its internal system calls on "
"receiving an :const:`EINTR` signal. (Reported by several people; final "
"patch by Gregory P. Smith in :issue:`1068268`.)"
msgstr ""
# 74c3cf63d88a4c6886c43b4a1d15eef0
#: ../src/Doc/whatsnew/2.7.rst:1578
msgid ""
"New function: :func:`~symtable.Symbol.is_declared_global` in the :mod:"
"`symtable` module returns true for variables that are explicitly declared to "
"be global, false for ones that are implicitly global. (Contributed by Jeremy "
"Hylton.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1583 ../src/Doc/whatsnew/2.7.rst:2458
msgid ""
"The :mod:`syslog` module will now use the value of ``sys.argv[0]`` as the "
"identifier instead of the previous default value of ``'python'``. (Changed "
"by Sean Reifschneider; :issue:`8451`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1587
msgid ""
"The ``sys.version_info`` value is now a named tuple, with attributes named :"
"attr:`major`, :attr:`minor`, :attr:`micro`, :attr:`releaselevel`, and :attr:"
"`serial`. (Contributed by Ross Light; :issue:`4285`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1592
msgid ""
":func:`sys.getwindowsversion` also returns a named tuple, with attributes "
"named :attr:`major`, :attr:`minor`, :attr:`build`, :attr:`platform`, :attr:"
"`service_pack`, :attr:`service_pack_major`, :attr:`service_pack_minor`, :"
"attr:`suite_mask`, and :attr:`product_type`. (Contributed by Brian Curtin; :"
"issue:`7766`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1598 ../src/Doc/whatsnew/2.7.rst:2462
msgid ""
"The :mod:`tarfile` module's default error handling has changed, to no longer "
"suppress fatal errors. The default error level was previously 0, which "
"meant that errors would only result in a message being written to the debug "
"log, but because the debug log is not activated by default, these errors go "
"unnoticed. The default error level is now 1, which raises an exception if "
"there's an error. (Changed by Lars Gustäbel; :issue:`7357`.)"
msgstr ""
# 45bc9adc9d604351b4d64928bc77127c
#: ../src/Doc/whatsnew/2.7.rst:1606
msgid ""
":mod:`tarfile` now supports filtering the :class:`~tarfile.TarInfo` objects "
"being added to a tar file. When you call :meth:`~tarfile.TarFile.add`, you "
"may supply an optional *filter* argument that's a callable. The *filter* "
"callable will be passed the :class:`~tarfile.TarInfo` for every file being "
"added, and can modify and return it. If the callable returns ``None``, the "
"file will be excluded from the resulting archive. This is more powerful "
"than the existing *exclude* argument, which has therefore been deprecated. "
"(Added by Lars Gustäbel; :issue:`6856`.) The :class:`~tarfile.TarFile` class "
"also now supports the context management protocol. (Added by Lars Gustäbel; :"
"issue:`7232`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1618
msgid ""
"The :meth:`~threading.Event.wait` method of the :class:`threading.Event` "
"class now returns the internal flag on exit. This means the method will "
"usually return true because :meth:`~threading.Event.wait` is supposed to "
"block until the internal flag becomes true. The return value will only be "
"false if a timeout was provided and the operation timed out. (Contributed by "
"Tim Lesher; :issue:`1674032`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1625
msgid ""
"The Unicode database provided by the :mod:`unicodedata` module is now used "
"internally to determine which characters are numeric, whitespace, or "
"represent line breaks. The database also includes information from the :"
"file:`Unihan.txt` data file (patch by Anders Chrigström and Amaury Forgeot "
"d'Arc; :issue:`1571184`) and has been updated to version 5.2.0 (updated by "
"Florent Xicluna; :issue:`8024`)."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1633 ../src/Doc/whatsnew/2.7.rst:2470
msgid ""
"The :mod:`urlparse` module's :func:`~urlparse.urlsplit` now handles unknown "
"URL schemes in a fashion compliant with :rfc:`3986`: if the URL is of the "
"form ``\"<something>://...\"``, the text before the ``://`` is treated as "
"the scheme, even if it's a made-up scheme that the module doesn't know "
"about. This change may break code that worked around the old behaviour. "
"For example, Python 2.6.4 or 2.5 will return the following:"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1645 ../src/Doc/whatsnew/2.7.rst:2482
msgid "Python 2.7 (and Python 2.6.5) will return:"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1651 ../src/Doc/whatsnew/2.7.rst:2488
msgid ""
"(Python 2.7 actually produces slightly different output, since it returns a "
"named tuple instead of a standard tuple.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1654
msgid ""
"The :mod:`urlparse` module also supports IPv6 literal addresses as defined "
"by :rfc:`2732` (contributed by Senthil Kumaran; :issue:`2987`). ::"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1661
msgid ""
"New class: the :class:`~weakref.WeakSet` class in the :mod:`weakref` module "
"is a set that only holds weak references to its elements; elements will be "
"removed once there are no references pointing to them. (Originally "
"implemented in Python 3.x by Raymond Hettinger, and backported to 2.7 by "
"Michael Foord.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1667
msgid ""
"The ElementTree library, :mod:`xml.etree`, no longer escapes ampersands and "
"angle brackets when outputting an XML processing instruction (which looks "
"like ``<?xml-stylesheet href=\"#style1\"?>``) or comment (which looks like "
"``<!-- comment -->``). (Patch by Neil Muller; :issue:`2746`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1673
msgid ""
"The XML-RPC client and server, provided by the :mod:`xmlrpclib` and :mod:"
"`SimpleXMLRPCServer` modules, have improved performance by supporting "
"HTTP/1.1 keep-alive and by optionally using gzip encoding to compress the "
"XML being exchanged. The gzip compression is controlled by the :attr:"
"`encode_threshold` attribute of :class:`SimpleXMLRPCRequestHandler`, which "
"contains a size in bytes; responses larger than this will be compressed. "
"(Contributed by Kristján Valur Jónsson; :issue:`6267`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1682
msgid ""
"The :mod:`zipfile` module's :class:`~zipfile.ZipFile` now supports the "
"context management protocol, so you can write ``with zipfile.ZipFile(...) as "
"f:``. (Contributed by Brian Curtin; :issue:`5511`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1686
msgid ""
":mod:`zipfile` now also supports archiving empty directories and extracts "
"them correctly. (Fixed by Kuba Wieczorek; :issue:`4710`.) Reading files out "
"of an archive is faster, and interleaving :meth:`~zipfile.ZipFile.read` and :"
"meth:`~zipfile.ZipFile.readline` now works correctly. (Contributed by Nir "
"Aides; :issue:`7610`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1692
msgid ""
"The :func:`~zipfile.is_zipfile` function now accepts a file object, in "
"addition to the path names accepted in earlier versions. (Contributed by "
"Gabriel Genellina; :issue:`4756`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1696
msgid ""
"The :meth:`~zipfile.ZipFile.writestr` method now has an optional "
"*compress_type* parameter that lets you override the default compression "
"method specified in the :class:`~zipfile.ZipFile` constructor. (Contributed "
"by Ronald Oussoren; :issue:`6003`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1709
msgid "New module: importlib"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1711
msgid ""
"Python 3.1 includes the :mod:`importlib` package, a re-implementation of the "
"logic underlying Python's :keyword:`import` statement. :mod:`importlib` is "
"useful for implementors of Python interpreters and to users who wish to "
"write new importers that can participate in the import process. Python 2.7 "
"doesn't contain the complete :mod:`importlib` package, but instead has a "
"tiny subset that contains a single function, :func:`~importlib."
"import_module`."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1719
msgid ""
"``import_module(name, package=None)`` imports a module. *name* is a string "
"containing the module or package's name. It's possible to do relative "
"imports by providing a string that begins with a ``.`` character, such as "
"``..utils.errors``. For relative imports, the *package* argument must be "
"provided and is the name of the package that will be used as the anchor for "
"the relative import. :func:`~importlib.import_module` both inserts the "
"imported module into ``sys.modules`` and returns the module object."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1728
msgid "Here are some examples::"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1739
msgid ""
":mod:`importlib` was implemented by Brett Cannon and introduced in Python "
"3.1."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1744
msgid "New module: sysconfig"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1746
msgid ""
"The :mod:`sysconfig` module has been pulled out of the Distutils package, "
"becoming a new top-level module in its own right. :mod:`sysconfig` provides "
"functions for getting information about Python's build process: compiler "
"switches, installation paths, the platform name, and whether Python is "
"running from its source directory."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1753
msgid "Some of the functions in the module are:"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1755
msgid ""
":func:`~sysconfig.get_config_var` returns variables from Python's Makefile "
"and the :file:`pyconfig.h` file."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1757
msgid ""
":func:`~sysconfig.get_config_vars` returns a dictionary containing all of "
"the configuration variables."
msgstr ""
# 823e05961c114f5394b7bb494324798a
#: ../src/Doc/whatsnew/2.7.rst:1759
msgid ""
":func:`~sysconfig.get_path` returns the configured path for a particular "
"type of module: the standard library, site-specific modules, platform-"
"specific modules, etc."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1762
msgid ""
":func:`~sysconfig.is_python_build` returns true if you're running a binary "
"from a Python source tree, and false otherwise."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1765
msgid ""
"Consult the :mod:`sysconfig` documentation for more details and for a "
"complete list of functions."
msgstr ""
# 6f9330d8425b4260b43dbb83ddde891c
#: ../src/Doc/whatsnew/2.7.rst:1768
msgid ""
"The Distutils package and :mod:`sysconfig` are now maintained by Tarek "
"Ziadé, who has also started a Distutils2 package (source repository at "
"https://hg.python.org/distutils2/) for developing a next-generation version "
"of Distutils."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1775
msgid "ttk: Themed Widgets for Tk"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1777
msgid ""
"Tcl/Tk 8.5 includes a set of themed widgets that re-implement basic Tk "
"widgets but have a more customizable appearance and can therefore more "
"closely resemble the native platform's widgets. This widget set was "
"originally called Tile, but was renamed to Ttk (for \"themed Tk\") on being "
"added to Tcl/Tck release 8.5."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1783
msgid ""
"To learn more, read the :mod:`ttk` module documentation. You may also wish "
"to read the Tcl/Tk manual page describing the Ttk theme engine, available at "
"http://www.tcl.tk/man/tcl8.5/TkCmd/ttk_intro.htm. Some screenshots of the "
"Python/Ttk code in use are at http://code.google.com/p/python-ttk/wiki/"
"Screenshots."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1790
msgid ""
"The :mod:`ttk` module was written by Guilherme Polo and added in :issue:"
"`2983`. An alternate version called ``Tile.py``, written by Martin Franklin "
"and maintained by Kevin Walzer, was proposed for inclusion in :issue:`2618`, "
"but the authors argued that Guilherme Polo's work was more comprehensive."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1800
msgid "Updated module: unittest"
msgstr ""
# 861b7f15d5774f78803f4e043bb8b371
#: ../src/Doc/whatsnew/2.7.rst:1802
msgid ""
"The :mod:`unittest` module was greatly enhanced; many new features were "
"added. Most of these features were implemented by Michael Foord, unless "
"otherwise noted. The enhanced version of the module is downloadable "
"separately for use with Python versions 2.4 to 2.6, packaged as the :mod:"
"`unittest2` package, from https://pypi.python.org/pypi/unittest2."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1809
msgid ""
"When used from the command line, the module can automatically discover "
"tests. It's not as fancy as `py.test <http://pytest.org>`__ or `nose "
"<http://code.google.com/p/python-nose/>`__, but provides a simple way to run "
"tests kept within a set of package directories. For example, the following "
"command will search the :file:`test/` subdirectory for any importable test "
"files named ``test*.py``::"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1818
msgid ""
"Consult the :mod:`unittest` module documentation for more details. "
"(Developed in :issue:`6001`.)"
msgstr ""
# 78868bb9b9d444a688756a0586e6ecf7
#: ../src/Doc/whatsnew/2.7.rst:1821
msgid "The :func:`~unittest.main` function supports some other new options:"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1823
msgid ""
":option:`-b` or :option:`--buffer` will buffer the standard output and "
"standard error streams during each test. If the test passes, any resulting "
"output will be discarded; on failure, the buffered output will be displayed."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1828
msgid ""
":option:`-c` or :option:`--catch` will cause the control-C interrupt to be "
"handled more gracefully. Instead of interrupting the test process "
"immediately, the currently running test will be completed and then the "
"partial results up to the interruption will be reported. If you're "
"impatient, a second press of control-C will cause an immediate interruption."
msgstr ""
# ff0ad627767342339682e47de6da68ce
#: ../src/Doc/whatsnew/2.7.rst:1835
msgid ""
"This control-C handler tries to avoid causing problems when the code being "
"tested or the tests being run have defined a signal handler of their own, by "
"noticing that a signal handler was already set and calling it. If this "
"doesn't work for you, there's a :func:`~unittest.removeHandler` decorator "
"that can be used to mark tests that should have the control-C handling "
"disabled."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1842
msgid ""
":option:`-f` or :option:`--failfast` makes test execution stop immediately "
"when a test fails instead of continuing to execute further tests. "
"(Suggested by Cliff Dyer and implemented by Michael Foord; :issue:`8074`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1847
msgid ""
"The progress messages now show 'x' for expected failures and 'u' for "
"unexpected successes when run in verbose mode. (Contributed by Benjamin "
"Peterson.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1851
msgid ""
"Test cases can raise the :exc:`~unittest.SkipTest` exception to skip a test "
"(:issue:`1034053`)."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1854
msgid ""
"The error messages for :meth:`~unittest.TestCase.assertEqual`, :meth:"
"`~unittest.TestCase.assertTrue`, and :meth:`~unittest.TestCase.assertFalse` "
"failures now provide more information. If you set the :attr:`~unittest."
"TestCase.longMessage` attribute of your :class:`~unittest.TestCase` classes "
"to True, both the standard error message and any additional message you "
"provide will be printed for failures. (Added by Michael Foord; :issue:"
"`5663`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1861
msgid ""
"The :meth:`~unittest.TestCase.assertRaises` method now returns a context "
"handler when called without providing a callable object to run. For "
"example, you can write this::"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1868
msgid "(Implemented by Antoine Pitrou; :issue:`4444`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1872
msgid ""
"Module- and class-level setup and teardown fixtures are now supported. "
"Modules can contain :func:`~unittest.setUpModule` and :func:`~unittest."
"tearDownModule` functions. Classes can have :meth:`~unittest.TestCase."
"setUpClass` and :meth:`~unittest.TestCase.tearDownClass` methods that must "
"be defined as class methods (using ``@classmethod`` or equivalent). These "
"functions and methods are invoked when the test runner switches to a test "
"case in a different module or class."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1880
msgid ""
"The methods :meth:`~unittest.TestCase.addCleanup` and :meth:`~unittest."
"TestCase.doCleanups` were added. :meth:`~unittest.TestCase.addCleanup` lets "
"you add cleanup functions that will be called unconditionally (after :meth:"
"`~unittest.TestCase.setUp` if :meth:`~unittest.TestCase.setUp` fails, "
"otherwise after :meth:`~unittest.TestCase.tearDown`). This allows for much "
"simpler resource allocation and deallocation during tests (:issue:`5679`)."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1888
msgid ""
"A number of new methods were added that provide more specialized tests. "
"Many of these methods were written by Google engineers for use in their test "
"suites; Gregory P. Smith, Michael Foord, and GvR worked on merging them into "
"Python's version of :mod:`unittest`."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1893
msgid ""
":meth:`~unittest.TestCase.assertIsNone` and :meth:`~unittest.TestCase."
"assertIsNotNone` take one expression and verify that the result is or is not "
"``None``."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1896
msgid ""
":meth:`~unittest.TestCase.assertIs` and :meth:`~unittest.TestCase."
"assertIsNot` take two values and check whether the two values evaluate to "
"the same object or not. (Added by Michael Foord; :issue:`2578`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1900
msgid ""
":meth:`~unittest.TestCase.assertIsInstance` and :meth:`~unittest.TestCase."
"assertNotIsInstance` check whether the resulting object is an instance of a "
"particular class, or of one of a tuple of classes. (Added by Georg Brandl; :"
"issue:`7031`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1905
msgid ""
":meth:`~unittest.TestCase.assertGreater`, :meth:`~unittest.TestCase."
"assertGreaterEqual`, :meth:`~unittest.TestCase.assertLess`, and :meth:"
"`~unittest.TestCase.assertLessEqual` compare two quantities."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1909
msgid ""
":meth:`~unittest.TestCase.assertMultiLineEqual` compares two strings, and if "
"they're not equal, displays a helpful comparison that highlights the "
"differences in the two strings. This comparison is now used by default when "
"Unicode strings are compared with :meth:`~unittest.TestCase.assertEqual`."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1914
msgid ""
":meth:`~unittest.TestCase.assertRegexpMatches` and :meth:`~unittest.TestCase."
"assertNotRegexpMatches` checks whether the first argument is a string "
"matching or not matching the regular expression provided as the second "
"argument (:issue:`8038`)."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1919
msgid ""
":meth:`~unittest.TestCase.assertRaisesRegexp` checks whether a particular "
"exception is raised, and then also checks that the string representation of "
"the exception matches the provided regular expression."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1923
msgid ""
":meth:`~unittest.TestCase.assertIn` and :meth:`~unittest.TestCase."
"assertNotIn` tests whether *first* is or is not in *second*."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1926
msgid ""
":meth:`~unittest.TestCase.assertItemsEqual` tests whether two provided "
"sequences contain the same elements."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1929
msgid ""
":meth:`~unittest.TestCase.assertSetEqual` compares whether two sets are "
"equal, and only reports the differences between the sets in case of error."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1932
msgid ""
"Similarly, :meth:`~unittest.TestCase.assertListEqual` and :meth:`~unittest."
"TestCase.assertTupleEqual` compare the specified types and explain any "
"differences without necessarily printing their full values; these methods "
"are now used by default when comparing lists and tuples using :meth:"
"`~unittest.TestCase.assertEqual`. More generally, :meth:`~unittest.TestCase."
"assertSequenceEqual` compares two sequences and can optionally check whether "
"both sequences are of a particular type."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1940
msgid ""
":meth:`~unittest.TestCase.assertDictEqual` compares two dictionaries and "
"reports the differences; it's now used by default when you compare two "
"dictionaries using :meth:`~unittest.TestCase.assertEqual`. :meth:`~unittest."
"TestCase.assertDictContainsSubset` checks whether all of the key/value pairs "
"in *first* are found in *second*."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1945
msgid ""
":meth:`~unittest.TestCase.assertAlmostEqual` and :meth:`~unittest.TestCase."
"assertNotAlmostEqual` test whether *first* and *second* are approximately "
"equal. This method can either round their difference to an optionally-"
"specified number of *places* (the default is 7) and compare it to zero, or "
"require the difference to be smaller than a supplied *delta* value."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1951
msgid ""
":meth:`~unittest.TestLoader.loadTestsFromName` properly honors the :attr:"
"`~unittest.TestLoader.suiteClass` attribute of the :class:`~unittest."
"TestLoader`. (Fixed by Mark Roddy; :issue:`6866`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1955
msgid ""
"A new hook lets you extend the :meth:`~unittest.TestCase.assertEqual` method "
"to handle new data types. The :meth:`~unittest.TestCase."
"addTypeEqualityFunc` method takes a type object and a function. The function "
"will be used when both of the objects being compared are of the specified "
"type. This function should compare the two objects and raise an exception "
"if they don't match; it's a good idea for the function to provide additional "
"information about why the two objects aren't matching, much as the new "
"sequence comparison methods do."
msgstr ""
# a0e752d84ff042358209ac6e7e525f62
#: ../src/Doc/whatsnew/2.7.rst:1964
msgid ""
":func:`unittest.main` now takes an optional ``exit`` argument. If False, :"
"func:`~unittest.main` doesn't call :func:`sys.exit`, allowing :func:"
"`~unittest.main` to be used from the interactive interpreter. (Contributed "
"by J. Pablo Fernández; :issue:`3379`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1969
msgid ""
":class:`~unittest.TestResult` has new :meth:`~unittest.TestResult."
"startTestRun` and :meth:`~unittest.TestResult.stopTestRun` methods that are "
"called immediately before and after a test run. (Contributed by Robert "
"Collins; :issue:`5728`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1973
msgid ""
"With all these changes, the :file:`unittest.py` was becoming awkwardly "
"large, so the module was turned into a package and the code split into "
"several files (by Benjamin Peterson). This doesn't affect how the module is "
"imported or used."
msgstr ""
# 2fb039e038d142ae9839f7cc448016ec
#: ../src/Doc/whatsnew/2.7.rst:1980
msgid "http://www.voidspace.org.uk/python/articles/unittest2.shtml"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1981
msgid ""
"Describes the new features, how to use them, and the rationale for various "
"design decisions. (By Michael Foord.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1987
msgid "Updated module: ElementTree 1.3"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1989
msgid ""
"The version of the ElementTree library included with Python was updated to "
"version 1.3. Some of the new features are:"
msgstr ""
# 97339ec2f63e4886a6eaa36631811dca
#: ../src/Doc/whatsnew/2.7.rst:1992
msgid ""
"The various parsing functions now take a *parser* keyword argument giving "
"an :class:`~xml.etree.ElementTree.XMLParser` instance that will be used. "
"This makes it possible to override the file's internal encoding::"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:1999
msgid ""
"Errors in parsing XML now raise a :exc:`ParseError` exception, whose "
"instances have a :attr:`position` attribute containing a (*line*, *column*) "
"tuple giving the location of the problem."
msgstr ""
# 94aeab6169434e9bb24ee45e546a9e3f
#: ../src/Doc/whatsnew/2.7.rst:2003
msgid ""
"ElementTree's code for converting trees to a string has been significantly "
"reworked, making it roughly twice as fast in many cases. The :meth:"
"`ElementTree.write() <xml.etree.ElementTree.ElementTree.write>` and :meth:"
"`Element.write` methods now have a *method* parameter that can be \"xml"
"\" (the default), \"html\", or \"text\". HTML mode will output empty "
"elements as ``<empty></empty>`` instead of ``<empty/>``, and text mode will "
"skip over elements and only output the text chunks. If you set the :attr:"
"`tag` attribute of an element to ``None`` but leave its children in place, "
"the element will be omitted when the tree is written out, so you don't need "
"to do more extensive rearrangement to remove a single element."
msgstr ""
# 9f1136f8c75a4730bbb46bf1d3912723
#: ../src/Doc/whatsnew/2.7.rst:2015
msgid ""
"Namespace handling has also been improved. All ``xmlns:<whatever>`` "
"declarations are now output on the root element, not scattered throughout "
"the resulting XML. You can set the default namespace for a tree by setting "
"the :attr:`default_namespace` attribute and can register new prefixes with :"
"meth:`~xml.etree.ElementTree.register_namespace`. In XML mode, you can use "
"the true/false *xml_declaration* parameter to suppress the XML declaration."
msgstr ""
# 0c3f032fece84fbd83c663737aa41a93
#: ../src/Doc/whatsnew/2.7.rst:2023
msgid ""
"New :class:`~xml.etree.ElementTree.Element` method: :meth:`~xml.etree."
"ElementTree.Element.extend` appends the items from a sequence to the "
"element's children. Elements themselves behave like sequences, so it's easy "
"to move children from one element to another::"
msgstr ""
# 8dec8f1741604715a0ef50181b59dc2b
#: ../src/Doc/whatsnew/2.7.rst:2040
msgid ""
"New :class:`Element` method: :meth:`~xml.etree.ElementTree.Element.iter` "
"yields the children of the element as a generator. It's also possible to "
"write ``for child in elem:`` to loop over an element's children. The "
"existing method :meth:`getiterator` is now deprecated, as is :meth:"
"`getchildren` which constructs and returns a list of children."
msgstr ""
# a65c479231544089bdeffdd61a0a3da4
#: ../src/Doc/whatsnew/2.7.rst:2047
msgid ""
"New :class:`Element` method: :meth:`~xml.etree.ElementTree.Element.itertext` "
"yields all chunks of text that are descendants of the element. For example::"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:2058
msgid ""
"Deprecated: using an element as a Boolean (i.e., ``if elem:``) would return "
"true if the element had any children, or false if there were no children. "
"This behaviour is confusing -- ``None`` is false, but so is a childless "
"element? -- so it will now trigger a :exc:`FutureWarning`. In your code, "
"you should be explicit: write ``len(elem) != 0`` if you're interested in the "
"number of children, or ``elem is not None``."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:2066
msgid ""
"Fredrik Lundh develops ElementTree and produced the 1.3 version; you can "
"read his article describing 1.3 at http://effbot.org/zone/elementtree-13-"
"intro.htm. Florent Xicluna updated the version included with Python, after "
"discussions on python-dev and in :issue:`6472`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:2080
msgid ""
"The latest release of the GNU Debugger, GDB 7, can be `scripted using Python "
"<http://sourceware.org/gdb/current/onlinedocs/gdb/Python.html>`__. When you "
"begin debugging an executable program P, GDB will look for a file named ``P-"
"gdb.py`` and automatically read it. Dave Malcolm contributed a :file:"
"`python-gdb.py` that adds a number of commands useful when debugging Python "
"itself. For example, ``py-up`` and ``py-down`` go up or down one Python "
"stack frame, which usually corresponds to several C stack frames. ``py-"
"print`` prints the value of a Python variable, and ``py-bt`` prints the "
"Python stack trace. (Added as a result of :issue:`8032`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:2092
msgid ""
"If you use the :file:`.gdbinit` file provided with Python, the \"pyo\" macro "
"in the 2.7 version now works correctly when the thread being debugged "
"doesn't hold the GIL; the macro now acquires it before printing. "
"(Contributed by Victor Stinner; :issue:`3632`.)"
msgstr ""
# 4031db26c55246a78d33aab861ae67a4
#: ../src/Doc/whatsnew/2.7.rst:2097
msgid ""
":c:func:`Py_AddPendingCall` is now thread-safe, letting any worker thread "
"submit notifications to the main Python thread. This is particularly useful "
"for asynchronous IO operations. (Contributed by Kristján Valur Jónsson; :"
"issue:`4293`.)"
msgstr ""
# 68a30205095d4b5cb2fdc7acecad276e
#: ../src/Doc/whatsnew/2.7.rst:2102
msgid ""
"New function: :c:func:`PyCode_NewEmpty` creates an empty code object; only "
"the filename, function name, and first line number are required. This is "
"useful for extension modules that are attempting to construct a more useful "
"traceback stack. Previously such extensions needed to call :c:func:"
"`PyCode_New`, which had many more arguments. (Added by Jeffrey Yasskin.)"
msgstr ""
# e6eada9609f64bbbbae32947543b96c6
#: ../src/Doc/whatsnew/2.7.rst:2109
msgid ""
"New function: :c:func:`PyErr_NewExceptionWithDoc` creates a new exception "
"class, just as the existing :c:func:`PyErr_NewException` does, but takes an "
"extra ``char *`` argument containing the docstring for the new exception "
"class. (Added by 'lekma' on the Python bug tracker; :issue:`7033`.)"
msgstr ""
# 93e56a50123b4232a4c5239301fe1a2b
#: ../src/Doc/whatsnew/2.7.rst:2115
msgid ""
"New function: :c:func:`PyFrame_GetLineNumber` takes a frame object and "
"returns the line number that the frame is currently executing. Previously "
"code would need to get the index of the bytecode instruction currently "
"executing, and then look up the line number corresponding to that address. "
"(Added by Jeffrey Yasskin.)"
msgstr ""
# 70900fc08d214463a1f82f9cc236c755
#: ../src/Doc/whatsnew/2.7.rst:2121
msgid ""
"New functions: :c:func:`PyLong_AsLongAndOverflow` and :c:func:"
"`PyLong_AsLongLongAndOverflow` approximates a Python long integer as a C :c:"
"type:`long` or :c:type:`long long`. If the number is too large to fit into "
"the output type, an *overflow* flag is set and returned to the caller. "
"(Contributed by Case Van Horsen; :issue:`7528` and :issue:`7767`.)"
msgstr ""
# a770df269bd0499ba21196c790390d0d
#: ../src/Doc/whatsnew/2.7.rst:2128
msgid ""
"New function: stemming from the rewrite of string-to-float conversion, a "
"new :c:func:`PyOS_string_to_double` function was added. The old :c:func:"
"`PyOS_ascii_strtod` and :c:func:`PyOS_ascii_atof` functions are now "
"deprecated."
msgstr ""
# b2f22fda00694947b376ef96d2fcb14c
#: ../src/Doc/whatsnew/2.7.rst:2133
msgid ""
"New function: :c:func:`PySys_SetArgvEx` sets the value of ``sys.argv`` and "
"can optionally update ``sys.path`` to include the directory containing the "
"script named by ``sys.argv[0]`` depending on the value of an *updatepath* "
"parameter."
msgstr ""
# bc9e033180884b9f9b643eae7fa62818
#: ../src/Doc/whatsnew/2.7.rst:2138
msgid ""
"This function was added to close a security hole for applications that embed "
"Python. The old function, :c:func:`PySys_SetArgv`, would always update "
"``sys.path``, and sometimes it would add the current directory. This meant "
"that, if you ran an application embedding Python in a directory controlled "
"by someone else, attackers could put a Trojan-horse module in the directory "
"(say, a file named :file:`os.py`) that your application would then import "
"and run."
msgstr ""
# d1ada15796bb4a9791f87f19308ab2d1
#: ../src/Doc/whatsnew/2.7.rst:2146
msgid ""
"If you maintain a C/C++ application that embeds Python, check whether you're "
"calling :c:func:`PySys_SetArgv` and carefully consider whether the "
"application should be using :c:func:`PySys_SetArgvEx` with *updatepath* set "
"to false."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:2151
msgid ""
"Security issue reported as `CVE-2008-5983 <http://cve.mitre.org/cgi-bin/"
"cvename.cgi?name=CVE-2008-5983>`_; discussed in :issue:`5753`, and fixed by "
"Antoine Pitrou."
msgstr ""
# 5dc133cf449a48e78b8084a6869e6163
#: ../src/Doc/whatsnew/2.7.rst:2155
msgid ""
"New macros: the Python header files now define the following macros: :c:"
"macro:`Py_ISALNUM`, :c:macro:`Py_ISALPHA`, :c:macro:`Py_ISDIGIT`, :c:macro:"
"`Py_ISLOWER`, :c:macro:`Py_ISSPACE`, :c:macro:`Py_ISUPPER`, :c:macro:"
"`Py_ISXDIGIT`, :c:macro:`Py_TOLOWER`, and :c:macro:`Py_TOUPPER`. All of "
"these functions are analogous to the C standard macros for classifying "
"characters, but ignore the current locale setting, because in several places "
"Python needs to analyze characters in a locale-independent way. (Added by "
"Eric Smith; :issue:`5793`.)"
msgstr ""
# d4c9d09dcab9415e8f304e84ff35c035
#: ../src/Doc/whatsnew/2.7.rst:2173
msgid ""
"Removed function: :c:macro:`PyEval_CallObject` is now only available as a "
"macro. A function version was being kept around to preserve ABI linking "
"compatibility, but that was in 1997; it can certainly be deleted by now. "
"(Removed by Antoine Pitrou; :issue:`8276`.)"
msgstr ""
# 1d74ed9bb79b42a2aee879611aeec43e
#: ../src/Doc/whatsnew/2.7.rst:2178
msgid ""
"New format codes: the :c:func:`PyFormat_FromString`, :c:func:"
"`PyFormat_FromStringV`, and :c:func:`PyErr_Format` functions now accept ``"
"%lld`` and ``%llu`` format codes for displaying C's :c:type:`long long` "
"types. (Contributed by Mark Dickinson; :issue:`7228`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:2184
msgid ""
"The complicated interaction between threads and process forking has been "
"changed. Previously, the child process created by :func:`os.fork` might "
"fail because the child is created with only a single thread running, the "
"thread performing the :func:`os.fork`. If other threads were holding a lock, "
"such as Python's import lock, when the fork was performed, the lock would "
"still be marked as \"held\" in the new process. But in the child process "
"nothing would ever release the lock, since the other threads weren't "
"replicated, and the child process would no longer be able to perform imports."
msgstr ""
# 6660957ee96241ba8dd3061f1cdb5d0b
#: ../src/Doc/whatsnew/2.7.rst:2194
msgid ""
"Python 2.7 acquires the import lock before performing an :func:`os.fork`, "
"and will also clean up any locks created using the :mod:`threading` module. "
"C extension modules that have internal locks, or that call :c:func:`fork()` "
"themselves, will not benefit from this clean-up."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:2200
msgid "(Fixed by Thomas Wouters; :issue:`1590864`.)"
msgstr ""
# fdc9f35fcfc244e78ed2576c474ac487
#: ../src/Doc/whatsnew/2.7.rst:2202
msgid ""
"The :c:func:`Py_Finalize` function now calls the internal :func:`threading."
"_shutdown` function; this prevents some exceptions from being raised when an "
"interpreter shuts down. (Patch by Adam Olsen; :issue:`1722344`.)"
msgstr ""
# 31e23f5a3d61462db7142880c02c8cdf
#: ../src/Doc/whatsnew/2.7.rst:2207
msgid ""
"When using the :c:type:`PyMemberDef` structure to define attributes of a "
"type, Python will no longer let you try to delete or set a :const:"
"`T_STRING_INPLACE` attribute."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:2213
msgid ""
"Global symbols defined by the :mod:`ctypes` module are now prefixed with "
"``Py``, or with ``_ctypes``. (Implemented by Thomas Heller; :issue:`3102`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:2217
msgid ""
"New configure option: the :option:`--with-system-expat` switch allows "
"building the :mod:`pyexpat` module to use the system Expat library. "
"(Contributed by Arfrever Frehtes Taifersar Arahesis; :issue:`7609`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:2221
msgid ""
"New configure option: the :option:`--with-valgrind` option will now disable "
"the pymalloc allocator, which is difficult for the Valgrind memory-error "
"detector to analyze correctly. Valgrind will therefore be better at "
"detecting memory leaks and overruns. (Contributed by James Henstridge; :"
"issue:`2422`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:2228
msgid ""
"New configure option: you can now supply an empty string to :option:`--with-"
"dbmliborder=` in order to disable all of the various DBM modules. (Added by "
"Arfrever Frehtes Taifersar Arahesis; :issue:`6491`.)"
msgstr ""
# 3754033b8fbb4ebc8d29de8835b8ad7e
#: ../src/Doc/whatsnew/2.7.rst:2233
msgid ""
"The :program:`configure` script now checks for floating-point rounding bugs "
"on certain 32-bit Intel chips and defines a :c:macro:`X87_DOUBLE_ROUNDING` "
"preprocessor definition. No code currently uses this definition, but it's "
"available if anyone wishes to use it. (Added by Mark Dickinson; :issue:"
"`2937`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:2239
msgid ""
":program:`configure` also now sets a :envvar:`LDCXXSHARED` Makefile variable "
"for supporting C++ linking. (Contributed by Arfrever Frehtes Taifersar "
"Arahesis; :issue:`1222585`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:2243
msgid ""
"The build process now creates the necessary files for pkg-config support. "
"(Contributed by Clinton Roy; :issue:`3585`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:2246
msgid ""
"The build process now supports Subversion 1.7. (Contributed by Arfrever "
"Frehtes Taifersar Arahesis; :issue:`6094`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:2253
msgid "Capsules"
msgstr "Capsules"
# 448b963908564c1e832dd9677ecce54b
#: ../src/Doc/whatsnew/2.7.rst:2255
msgid ""
"Python 3.1 adds a new C datatype, :c:type:`PyCapsule`, for providing a C API "
"to an extension module. A capsule is essentially the holder of a C ``void "
"*`` pointer, and is made available as a module attribute; for example, the :"
"mod:`socket` module's API is exposed as ``socket.CAPI``, and :mod:"
"`unicodedata` exposes ``ucnhash_CAPI``. Other extensions can import the "
"module, access its dictionary to get the capsule object, and then get the "
"``void *`` pointer, which will usually point to an array of pointers to the "
"module's various API functions."
msgstr ""
# 55650eabd29a4038865bc5c844e98456
#: ../src/Doc/whatsnew/2.7.rst:2264
msgid ""
"There is an existing data type already used for this, :c:type:`PyCObject`, "
"but it doesn't provide type safety. Evil code written in pure Python could "
"cause a segmentation fault by taking a :c:type:`PyCObject` from module A and "
"somehow substituting it for the :c:type:`PyCObject` in module B. Capsules "
"know their own name, and getting the pointer requires providing the name::"
msgstr ""
# 36af2d2631484f5c8b7fa9b437829739
#: ../src/Doc/whatsnew/2.7.rst:2280
msgid ""
"You are assured that ``vtable`` points to whatever you're expecting. If a "
"different capsule was passed in, :c:func:`PyCapsule_IsValid` would detect "
"the mismatched name and return false. Refer to :ref:`using-capsules` for "
"more information on using these objects."
msgstr ""
# 128a31379d20442f9e13d7dff5c60768
#: ../src/Doc/whatsnew/2.7.rst:2285
msgid ""
"Python 2.7 now uses capsules internally to provide various extension-module "
"APIs, but the :c:func:`PyCObject_AsVoidPtr` was modified to handle capsules, "
"preserving compile-time compatibility with the :c:type:`CObject` interface. "
"Use of :c:func:`PyCObject_AsVoidPtr` will signal a :exc:"
"`PendingDeprecationWarning`, which is silent by default."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:2292
msgid ""
"Implemented in Python 3.1 and backported to 2.7 by Larry Hastings; discussed "
"in :issue:`5630`."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:2301
msgid ""
"The :mod:`msvcrt` module now contains some constants from the :file:"
"`crtassem.h` header file: :data:`CRT_ASSEMBLY_VERSION`, :data:"
"`VC_ASSEMBLY_PUBLICKEYTOKEN`, and :data:`LIBRARIES_ASSEMBLY_NAME_PREFIX`. "
"(Contributed by David Cournapeau; :issue:`4365`.)"
msgstr ""
# 764a2735eabc42c69ee15e6d7870bcee
#: ../src/Doc/whatsnew/2.7.rst:2308
msgid ""
"The :mod:`_winreg` module for accessing the registry now implements the :"
"func:`~_winreg.CreateKeyEx` and :func:`~_winreg.DeleteKeyEx` functions, "
"extended versions of previously-supported functions that take several extra "
"arguments. The :func:`~_winreg.DisableReflectionKey`, :func:`~_winreg."
"EnableReflectionKey`, and :func:`~_winreg.QueryReflectionKey` were also "
"tested and documented. (Implemented by Brian Curtin: :issue:`7347`.)"
msgstr ""
# f60ce873118446959a555fd0e0aaeb1f
#: ../src/Doc/whatsnew/2.7.rst:2316
msgid ""
"The new :c:func:`_beginthreadex` API is used to start threads, and the "
"native thread-local storage functions are now used. (Contributed by Kristján "
"Valur Jónsson; :issue:`3582`.)"
msgstr ""
# dbd1e309b98b451caf6cab669f975ec0
#: ../src/Doc/whatsnew/2.7.rst:2320
msgid ""
"The :func:`os.kill` function now works on Windows. The signal value can be "
"the constants :const:`CTRL_C_EVENT`, :const:`CTRL_BREAK_EVENT`, or any "
"integer. The first two constants will send Control-C and Control-Break "
"keystroke events to subprocesses; any other value will use the :c:func:"
"`TerminateProcess` API. (Contributed by Miki Tebeka; :issue:`1220212`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:2327
msgid ""
"The :func:`os.listdir` function now correctly fails for an empty path. "
"(Fixed by Hirokazu Yamamoto; :issue:`5913`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:2330
msgid ""
"The :mod:`mimelib` module will now read the MIME database from the Windows "
"registry when initializing. (Patch by Gabriel Genellina; :issue:`4969`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:2339
msgid ""
"The path ``/Library/Python/2.7/site-packages`` is now appended to ``sys."
"path``, in order to share added packages between the system installation and "
"a user-installed copy of the same version. (Changed by Ronald Oussoren; :"
"issue:`4865`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:2345
msgid "Port-Specific Changes: FreeBSD"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:2347
msgid ""
"FreeBSD 7.1's :const:`SO_SETFIB` constant, used with :func:`~socket."
"getsockopt`/:func:`~socket.setsockopt` to select an alternate routing table, "
"is now available in the :mod:`socket` module. (Added by Kyle VanderBeek; :"
"issue:`8235`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:2355
msgid ""
"Two benchmark scripts, :file:`iobench` and :file:`ccbench`, were added to "
"the :file:`Tools` directory. :file:`iobench` measures the speed of the "
"built-in file I/O objects returned by :func:`open` while performing various "
"operations, and :file:`ccbench` is a concurrency benchmark that tries to "
"measure computing throughput, thread switching latency, and IO processing "
"bandwidth when performing several tasks using a varying number of threads."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:2363
msgid ""
"The :file:`Tools/i18n/msgfmt.py` script now understands plural forms in :"
"file:`.po` files. (Fixed by Martin von Löwis; :issue:`5464`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:2367
msgid ""
"When importing a module from a :file:`.pyc` or :file:`.pyo` file with an "
"existing :file:`.py` counterpart, the :attr:`co_filename` attributes of the "
"resulting code objects are overwritten when the original filename is "
"obsolete. This can happen if the file has been renamed, moved, or is "
"accessed through different paths. (Patch by Ziga Seilnacht and Jean-Paul "
"Calderone; :issue:`1180193`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:2374
msgid ""
"The :file:`regrtest.py` script now takes a :option:`--randseed=` switch that "
"takes an integer that will be used as the random seed for the :option:`-r` "
"option that executes tests in random order. The :option:`-r` option also "
"reports the seed that was used (Added by Collin Winter.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:2380
msgid ""
"Another :file:`regrtest.py` switch is :option:`-j`, which takes an integer "
"specifying how many tests run in parallel. This allows reducing the total "
"runtime on multi-core machines. This option is compatible with several other "
"options, including the :option:`-R` switch which is known to produce long "
"runtimes. (Added by Antoine Pitrou, :issue:`6152`.) This can also be used "
"with a new :option:`-F` switch that runs selected tests in a loop until they "
"fail. (Added by Antoine Pitrou; :issue:`7312`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:2389
msgid ""
"When executed as a script, the :file:`py_compile.py` module now accepts "
"``'-'`` as an argument, which will read standard input for the list of "
"filenames to be compiled. (Contributed by Piotr Ożarowski; :issue:`8233`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:2397
msgid "Porting to Python 2.7"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:2402
msgid ""
"The :func:`range` function processes its arguments more consistently; it "
"will now call :meth:`__int__` on non-float, non-integer arguments that are "
"supplied to it. (Fixed by Alexander Belopolsky; :issue:`1533`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:2407
msgid ""
"The string :meth:`format` method changed the default precision used for "
"floating-point and complex numbers from 6 decimal places to 12, which "
"matches the precision used by :func:`str`. (Changed by Eric Smith; :issue:"
"`5920`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:2412
msgid ""
"Because of an optimization for the :keyword:`with` statement, the special "
"methods :meth:`__enter__` and :meth:`__exit__` must belong to the object's "
"type, and cannot be directly attached to the object's instance. This "
"affects new-style classes (derived from :class:`object`) and C extension "
"types. (:issue:`6101`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:2418
msgid ""
"Due to a bug in Python 2.6, the *exc_value* parameter to :meth:`__exit__` "
"methods was often the string representation of the exception, not an "
"instance. This was fixed in 2.7, so *exc_value* will be an instance as "
"expected. (Fixed by Florent Xicluna; :issue:`7853`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:2428
msgid "In the standard library:"
msgstr ""
# 2f073667b03d4d9388fcce671daf4f42
#: ../src/Doc/whatsnew/2.7.rst:2430
msgid ""
"Operations with :class:`~datetime.datetime` instances that resulted in a "
"year falling outside the supported range didn't always raise :exc:"
"`OverflowError`. Such errors are now checked more carefully and will now "
"raise the exception. (Reported by Mark Leander, patch by Anand B. Pillai and "
"Alexander Belopolsky; :issue:`7150`.)"
msgstr ""
# 43f98c8d96834680a070dc6eb7e8470b
#: ../src/Doc/whatsnew/2.7.rst:2436
msgid ""
"When using :class:`~decimal.Decimal` instances with a string's :meth:"
"`format` method, the default alignment was previously left-alignment. This "
"has been changed to right-alignment, which might change the output of your "
"programs. (Changed by Mark Dickinson; :issue:`6857`.)"
msgstr ""
# be53b3d77873484caeb9eaf696078f6f
#: ../src/Doc/whatsnew/2.7.rst:2442
msgid ""
"Comparisons involving a signaling NaN value (or ``sNAN``) now signal :const:"
"`~decimal.InvalidOperation` instead of silently returning a true or false "
"value depending on the comparison operator. Quiet NaN values (or ``NaN``) "
"are now hashable. (Fixed by Mark Dickinson; :issue:`7279`.)"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:2448
msgid ""
"The ElementTree library, :mod:`xml.etree`, no longer escapes ampersands and "
"angle brackets when outputting an XML processing instruction (which looks "
"like `<?xml-stylesheet href=\"#style1\"?>`) or comment (which looks like "
"`<!-- comment -->`). (Patch by Neil Muller; :issue:`2746`.)"
msgstr ""
# ad89c1d41efb4cd3beb37ab4f27611ec
#: ../src/Doc/whatsnew/2.7.rst:2454
msgid ""
"The :meth:`~StringIO.StringIO.readline` method of :class:`~StringIO."
"StringIO` objects now does nothing when a negative length is requested, as "
"other file-like objects do. (:issue:`7348`)."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:2491
msgid "For C extensions:"
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:2493
msgid ""
"C extensions that use integer format codes with the ``PyArg_Parse*`` family "
"of functions will now raise a :exc:`TypeError` exception instead of "
"triggering a :exc:`DeprecationWarning` (:issue:`5080`)."
msgstr ""
# 29096e1aced3447e8f4192c8467d5b4d
#: ../src/Doc/whatsnew/2.7.rst:2497
msgid ""
"Use the new :c:func:`PyOS_string_to_double` function instead of the old :c:"
"func:`PyOS_ascii_strtod` and :c:func:`PyOS_ascii_atof` functions, which are "
"now deprecated."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:2501
msgid "For applications that embed Python:"
msgstr ""
# 0717a82a83a64e259cf80692ca1f6c2d
#: ../src/Doc/whatsnew/2.7.rst:2503
msgid ""
"The :c:func:`PySys_SetArgvEx` function was added, letting applications close "
"a security hole when the existing :c:func:`PySys_SetArgv` function was "
"used. Check whether you're calling :c:func:`PySys_SetArgv` and carefully "
"consider whether the application should be using :c:func:`PySys_SetArgvEx` "
"with *updatepath* set to false."
msgstr ""
# 96d229a67fb7400289da84a25235bd17
#: ../src/Doc/whatsnew/2.7.rst:2516
msgid "New Features Added to Python 2.7 Maintenance Releases"
msgstr ""
# 5679683e30294b7bbea3812ba1f3d002
#: ../src/Doc/whatsnew/2.7.rst:2518
msgid ""
"New features may be added to Python 2.7 maintenance releases when the "
"situation genuinely calls for it. Any such additions must go through the "
"Python Enhancement Proposal process, and make a compelling case for why they "
"can't be adequately addressed by either adding the new feature solely to "
"Python 3, or else by publishing it on the Python Package Index."
msgstr ""
# a5f6c5013bf44c74a3ff7f7203c5cb61
#: ../src/Doc/whatsnew/2.7.rst:2524
msgid ""
"In addition to the specific proposals listed below, there is a general "
"exemption allowing new ``-3`` warnings to be added in any Python 2.7 "
"maintenance release."
msgstr ""
# 469ff7b7a0574ac4aa84d62fb50de430
#: ../src/Doc/whatsnew/2.7.rst:2530
msgid "PEP 434: IDLE Enhancement Exception for All Branches"
msgstr ""
# 643c268efc0d4d9ebd6fad6dc47eff55
#: ../src/Doc/whatsnew/2.7.rst:2532
msgid ""
":pep:`434` describes a general exemption for changes made to the IDLE "
"development environment shipped along with Python. This exemption makes it "
"possible for the IDLE developers to provide a more consistent user "
"experience across all supported versions of Python 2 and 3."
msgstr ""
# 65e80a1d9275457999b1876d677c7110
#: ../src/Doc/whatsnew/2.7.rst:2537
msgid ""
"For details of any IDLE changes, refer to the NEWS file for the specific "
"release."
msgstr ""
# b6a873696a2249fbbeb53cfb555bcd59
#: ../src/Doc/whatsnew/2.7.rst:2542
msgid "PEP 466: Network Security Enhancements for Python 2.7"
msgstr ""
# 3190ad3bfad841e7b19ab9321474b2b5
#: ../src/Doc/whatsnew/2.7.rst:2544
msgid ""
":pep:`466` describes a number of network security enhancement proposals that "
"have been approved for inclusion in Python 2.7 maintenance releases, with "
"the first of those changes appearing in the Python 2.7.7 release."
msgstr ""
# 9ac886b6388c4af4bc1b980b9112b7e4
#: ../src/Doc/whatsnew/2.7.rst:2548
msgid ":pep:`466` related features added in Python 2.7.7:"
msgstr ""
# 4031db26c55246a78d33aab861ae67a4
#: ../src/Doc/whatsnew/2.7.rst:2550
msgid ""
":func:`hmac.compare_digest` was backported from Python 3 to make a timing "
"attack resistant comparison operation available to Python 2 applications. "
"(Contributed by Alex Gaynor; :issue:`21306`.)"
msgstr ""
# 3d7be57d3e354312aeb6061e45749a3b
#: ../src/Doc/whatsnew/2.7.rst:2554
msgid ""
"OpenSSL 1.0.1g was upgraded in the official Windows installers published on "
"python.org. (Contributed by Zachary Ware; :issue:`21462`.)"
msgstr ""
# 3fd8e63edeb04d13a1bf31abc1e8d9bf
#: ../src/Doc/whatsnew/2.7.rst:2557
msgid ":pep:`466` related features added in Python 2.7.8:"
msgstr ""
# 4031db26c55246a78d33aab861ae67a4
#: ../src/Doc/whatsnew/2.7.rst:2559
msgid ""
":func:`hashlib.pbkdf2_hmac` was backported from Python 3 to make a hashing "
"algorithm suitable for secure password storage broadly available to Python 2 "
"applications. (Contributed by Alex Gaynor; :issue:`21304`.)"
msgstr ""
# 3d7be57d3e354312aeb6061e45749a3b
#: ../src/Doc/whatsnew/2.7.rst:2563
msgid ""
"OpenSSL 1.0.1h was upgraded for the official Windows installers published on "
"python.org. (contributed by Zachary Ware in :issue:`21671` for CVE-2014-0224)"
msgstr ""
# 21b97f764322446896bf230ff16f90ff
#: ../src/Doc/whatsnew/2.7.rst:2566
msgid ":pep:`466` related features added in Python 2.7.9:"
msgstr ""
# 92950005069645dea47fa5fe77f0d2c1
#: ../src/Doc/whatsnew/2.7.rst:2568
msgid ""
"Most of Python 3.4's :mod:`ssl` module was backported. This means :mod:`ssl` "
"now supports Server Name Indication, TLS1.x settings, access to the platform "
"certificate store, the :class:`~ssl.SSLContext` class, and other features. "
"(Contributed by Alex Gaynor and David Reid; :issue:`21308`.)"
msgstr ""
# 700975765eb84b91a128068d49c163e3
#: ../src/Doc/whatsnew/2.7.rst:2573
msgid ""
"Refer to the \"Version added: 2.7.9\" notes in the module documentation for "
"specific details."
msgstr ""
# 4031db26c55246a78d33aab861ae67a4
#: ../src/Doc/whatsnew/2.7.rst:2576
msgid ""
":func:`os.urandom` was changed to cache a file descriptor to ``/dev/"
"urandom`` instead of reopening ``/dev/urandom`` on every call. (Contributed "
"by Alex Gaynor; :issue:`21305`.)"
msgstr ""
# f64ff06c11504bf0bb1841aec60799da
#: ../src/Doc/whatsnew/2.7.rst:2580
msgid ""
":data:`hashlib.algorithms_guaranteed` and :data:`hashlib."
"algorithms_available` were backported from Python 3 to make it easier for "
"Python 2 applications to select the strongest available hash algorithm. "
"(Contributed by Alex Gaynor in :issue:`21307`)"
msgstr ""
# 58ed34f206ad4bc48708dbe4b0e1bb83
#: ../src/Doc/whatsnew/2.7.rst:2587
msgid "PEP 477: Backport ensurepip (PEP 453) to Python 2.7"
msgstr ""
# 32cbad7a8bc9422eb5495c45a97b787d
#: ../src/Doc/whatsnew/2.7.rst:2589
msgid ""
":pep:`477` approves the inclusion of the :pep:`453` ensurepip module and the "
"improved documentation that was enabled by it in the Python 2.7 maintenance "
"releases, appearing first in the the Python 2.7.9 release."
msgstr ""
# 61cf6e2a20754a9a9290ad80d5c2d7b3
#: ../src/Doc/whatsnew/2.7.rst:2595
msgid "Bootstrapping pip By Default"
msgstr ""
# 21483effcf02471bb0f67feacaf0033d
#: ../src/Doc/whatsnew/2.7.rst:2597
msgid ""
"The new :mod:`ensurepip` module (defined in :pep:`453`) provides a standard "
"cross-platform mechanism to bootstrap the pip installer into Python "
"installations. The version of ``pip`` included with Python 2.7.9 is ``pip`` "
"1.5.6, and future 2.7.x maintenance releases will update the bundled version "
"to the latest version of ``pip`` that is available at the time of creating "
"the release candidate."
msgstr ""
# 99e970ac7a1047229e25c19046d5db39
#: ../src/Doc/whatsnew/2.7.rst:2604
msgid ""
"By default, the commands ``pip``, ``pipX`` and ``pipX.Y`` will be installed "
"on all platforms (where X.Y stands for the version of the Python "
"installation), along with the ``pip`` Python package and its dependencies."
msgstr ""
# b887c6a58ef642cb8e0acc09317670b4
#: ../src/Doc/whatsnew/2.7.rst:2608
msgid ""
"On Windows and Mac OS X, the CPython installers now default to installing "
"``pip`` along with CPython itself (users may opt out of installing it during "
"the installation process). Window users will need to opt in to the automatic "
"``PATH`` modifications to have ``pip`` available from the command line by "
"default, otherwise it can still be accessed through the Python launcher for "
"Windows as ``py -m pip``."
msgstr ""
# 93690cd816d54e8bb9807e74122d9ab7
#: ../src/Doc/whatsnew/2.7.rst:2615
msgid ""
"As `discussed in the PEP`__, platform packagers may choose not to install "
"these commands by default, as long as, when invoked, they provide clear and "
"simple directions on how to install them on that platform (usually using the "
"system package manager)."
msgstr ""
# 8d82ba88da14450d8337cd115310e840
#: ../src/Doc/whatsnew/2.7.rst:2624
msgid "Documentation Changes"
msgstr ""
# 7bf58dda316c463db5efc35d9893ad11
#: ../src/Doc/whatsnew/2.7.rst:2626
msgid ""
"As part of this change, the :ref:`installing-index` and :ref:`distributing-"
"index` sections of the documentation have been completely redesigned as "
"short getting started and FAQ documents. Most packaging documentation has "
"now been moved out to the Python Packaging Authority maintained `Python "
"Packaging User Guide <http://packaging.python.org>`__ and the documentation "
"of the individual projects."
msgstr ""
# 8362a5561e48482f982933080b66d967
#: ../src/Doc/whatsnew/2.7.rst:2634
msgid ""
"However, as this migration is currently still incomplete, the legacy "
"versions of those guides remaining available as :ref:`install-index` and :"
"ref:`distutils-index`."
msgstr ""
# 7953824aa55942fa8f4fb767bb2ad58c
#: ../src/Doc/whatsnew/2.7.rst:2640
msgid ":pep:`453` -- Explicit bootstrapping of pip in Python installations"
msgstr ""
# dbec30431d6246f29c40bbe2bb287065
#: ../src/Doc/whatsnew/2.7.rst:2641
msgid ""
"PEP written by Donald Stufft and Nick Coghlan, implemented by Donald Stufft, "
"Nick Coghlan, Martin von Löwis and Ned Deily."
msgstr ""
#: ../src/Doc/whatsnew/2.7.rst:2652
msgid ""
"The author would like to thank the following people for offering "
"suggestions, corrections and assistance with various drafts of this article: "
"Nick Coghlan, Philip Jenvey, Ryan Lovett, R. David Murray, Hugh Secker-"
"Walker."
msgstr ""
#: ../src/Doc/whatsnew/index.rst:5
msgid "What's New in Python"
msgstr "Quoi de neuf dans Python"
#: ../src/Doc/whatsnew/index.rst:7
msgid ""
"The \"What's New in Python\" series of essays takes tours through the most "
"important changes between major Python versions. They are a \"must read\" "
"for anyone wishing to stay up-to-date after a new release."
msgstr ""
"La série d'essais \"Quoi de neuf dans Python\" reprend les plus importants "
"changements entres les versions majeures de Python. Elles sont à lire pour "
"quiconque souhaitant être à jour suite à une nouvelle sortie."
#~ msgid "Author"
#~ msgstr "Auteur"
#~ msgid "The *sqlite3* module has some new features:"
#~ msgstr "Le module *sqlite3* a quelques nouvelles fonctionnalités : "
#~ msgid "(Contributed by Antoine Pitrou; :issue:`3001`.)"
#~ msgstr "(Contribution par Antoine Pitrou; :issue:`3001`.)"
#~ msgid ""
#~ "Regular and recursive locks now accept an optional *timeout* argument to "
#~ "their ``acquire`` method. (Contributed by Antoine Pitrou; :issue:`7316`) "
#~ "Similarly, :meth:`threading.Semaphore.acquire` also gains a *timeout* "
#~ "argument. (Contributed by Torsten Landschoff; :issue:`850728`.)"
#~ msgstr ""
#~ "Les verrous standards et récursifs acceptent désormais un argument "
#~ "optionnel *timeout* à leur méthode ``acquire``. (Contribution par Antoine "
#~ "Pitrou; :issue:`7316`). Pareillement, :meth:`threading.Semaphore.acquire` "
#~ "acquière d'un argument *timeout* (Contribution par Torsten Landschoff; :"
#~ "issue:`850728`)."
#~ msgid "Porting to Python 3.2"
#~ msgstr "Portage vers Python 3.2"
#~ msgid ""
#~ "bytearray objects cannot be used anymore as filenames: convert them to "
#~ "bytes"
#~ msgstr ""
#~ "Les objets bytearray ne peuvent plus être utilisés en tant que nom de "
#~ "fichiers : les convertir en octets"
#~ msgid "PyArg_Parse*() functions:"
#~ msgstr "Les fonctions PyArg_Parse*() :"
#~ msgid "\"t#\" format has been removed: use \"s#\" or \"s*\" instead"
#~ msgstr ""
#~ "Le format \"t#\" a été supprimé : utiliser \"s#\" ou \"s*\" à la place"
#~ msgid "\"w\" and \"w#\" formats has been removed: use \"w*\" instead"
#~ msgstr ""
#~ "Les formats \"w\" et \"w#\" ont été supprimés : utiliser \"w*\" à la place"