Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
a2fe3340
Commit
a2fe3340
authored
Aug 11, 2012
by
Andrew Svetlov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #15527: fix docs, remove double parens by changing markup.
Patch by Serhiy Storchaka.
parent
b79be95d
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
95 additions
and
95 deletions
+95
-95
Doc/library/os.rst
Doc/library/os.rst
+1
-1
Doc/library/platform.rst
Doc/library/platform.rst
+2
-2
Doc/whatsnew/2.0.rst
Doc/whatsnew/2.0.rst
+5
-5
Doc/whatsnew/2.1.rst
Doc/whatsnew/2.1.rst
+4
-4
Doc/whatsnew/2.2.rst
Doc/whatsnew/2.2.rst
+11
-11
Doc/whatsnew/2.3.rst
Doc/whatsnew/2.3.rst
+20
-20
Doc/whatsnew/2.4.rst
Doc/whatsnew/2.4.rst
+22
-22
Doc/whatsnew/2.5.rst
Doc/whatsnew/2.5.rst
+29
-29
Doc/whatsnew/3.0.rst
Doc/whatsnew/3.0.rst
+1
-1
No files found.
Doc/library/os.rst
View file @
a2fe3340
...
...
@@ -450,7 +450,7 @@ process and user.
.. function:: setpgrp()
Call the system call :c:func:`setpgrp` or
:c:func:`setpgrp(0, 0)
` depending on
Call the system call :c:func:`setpgrp` or
``setpgrp(0, 0)`
` depending on
which version is implemented (if any). See the Unix manual for the semantics.
Availability: Unix.
...
...
Doc/library/platform.rst
View file @
a2fe3340
...
...
@@ -30,8 +30,8 @@ Cross Platform
returned as strings.
Values that cannot be determined are returned as given by the parameter presets.
If bits is given as ``''``, the
:c:func:`sizeof(pointer)
` (or
:c:func:`sizeof(long)
` on Python version < 1.5.2) is used as indicator for the
If bits is given as ``''``, the
``sizeof(pointer)`
` (or
``sizeof(long)`
` on Python version < 1.5.2) is used as indicator for the
supported pointer size.
The function relies on the system's :file:`file` command to do the actual work.
...
...
Doc/whatsnew/2.0.rst
View file @
a2fe3340
...
...
@@ -166,7 +166,7 @@ encoding. Encodings are named by strings, such as ``'ascii'``, ``'utf-8'``,
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
``sys.setdefaultencoding(encoding)`
` function in a customised version of
:file:`site.py`.
Combining 8-bit and Unicode strings always coerces to Unicode, using the default
...
...
@@ -203,7 +203,7 @@ U+0660 is an Arabic number.
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
often use the
``codecs.lookup(encoding)`
` function, which returns a
4-element tuple: ``(encode_func, decode_func, stream_reader, stream_writer)``.
* *encode_func* is a function that takes a Unicode string, and returns a 2-tuple
...
...
@@ -600,7 +600,7 @@ Python code is found to be improperly indented.
Changes to Built-in Functions
-----------------------------
A new built-in,
:func:`zip(seq1, seq2, ...)
`, has been added. :func:`zip`
A new built-in,
``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
...
...
@@ -619,7 +619,7 @@ 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.
Dictionaries have an odd new method,
:meth:`setdefault(key, default)
`, which
Dictionaries have an odd new method,
``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,
...
...
@@ -1038,7 +1038,7 @@ 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
module:
``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.
...
...
Doc/whatsnew/2.1.rst
View file @
a2fe3340
...
...
@@ -204,7 +204,7 @@ 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.
The built-in
:func:`cmp(A,B)
` function can use the rich comparison machinery,
The built-in
``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,
...
...
@@ -350,7 +350,7 @@ where this behaviour is undesirable, object caches being the most common one,
and
another
being
circular
references
in
data
structures
such
as
trees
.
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
function
``
f
(
x
)`
`
by
storing
the
function
's argument and its result in a
dictionary::
_cache = {}
...
...
@@ -656,7 +656,7 @@ New and Improved Modules
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
unsuitable for your application or network setup, call
``set_pasv(0)`
` on
FTP objects to disable passive mode.
* Support for raw socket access has been added to the :mod:`socket` module,
...
...
@@ -666,7 +666,7 @@ New and Improved Modules
for displaying timing profiles for Python programs, invoked when the module is
run as a script. Contributed by Eric S. Raymond.
* A new implementation-dependent function,
:func:`sys._getframe([depth])
`, has
* A new implementation-dependent function,
``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
...
...
Doc/whatsnew/2.2.rst
View file @
a2fe3340
...
...
@@ -173,12 +173,12 @@ attributes of their own:
* :attr:`__doc__` is the attribute's docstring.
*
:meth:`__get__(object)
` is a method that retrieves the attribute value from
*
``__get__(object)`
` is a method that retrieves the attribute value from
*object*.
*
:meth:`__set__(object, value)
` sets the attribute on *object* to *value*.
*
``__set__(object, value)`
` sets the attribute on *object* to *value*.
*
:meth:`__delete__(object, value)
` deletes the *value* attribute of *object*.
*
``__delete__(object, value)`
` deletes the *value* attribute of *object*.
For example, when you write ``obj.x``, the steps that Python actually performs
are::
...
...
@@ -288,7 +288,7 @@ 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
algorithm. The most commonly used form will be
``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::
...
...
@@ -301,7 +301,7 @@ will be used in methods to call a method in the superclass; for example,
...
:func:`super` can also return unbound superclass objects when called as
:func:`super(class)` or :func:`super(class1, class2)
`, but this probably won't
``super(class)`` or ``super(class1, class2)`
`, but this probably won't
often be useful.
...
...
@@ -314,13 +314,13 @@ 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.
First,
:meth:`__getattr__(attr_name)
` is still supported by new-style classes,
First,
``__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.
New-style classes also support a new method,
:meth:`__getattribute__(attr_name)
`. The difference between the two methods is
``__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.
...
...
@@ -441,8 +441,8 @@ work, though it really should.
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
basic idea of iterators is simple. A new built-in function,
``iter(obj)`
`
or ``iter(C, sentinel)``, is used to get an iterator.
``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.
...
...
@@ -793,7 +793,7 @@ further details.
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*])
`
encoding such as UTF-8 or Latin-1. A symmetric
``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.
...
...
@@ -1203,7 +1203,7 @@ Some of the more notable changes are:
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
used if
``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.)
...
...
Doc/whatsnew/2.3.rst
View file @
a2fe3340
...
...
@@ -501,8 +501,8 @@ This produces the following output::
ZeroDivisionError: integer division or modulo by zero
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. ::
The
``getLogger(name)`
` function is used to get a particular log, creating
it if it doesn't exist yet.
``getLogger(None)`
` returns the root logger. ::
log = logging.getLogger('server')
...
...
...
@@ -721,10 +721,10 @@ module:
objects to it. Additional built-in and frozen modules can be imported by an
object added to this list.
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
Importer objects must have a single method,
`
`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
single method,
``load_module(fullname)`
`, that creates and returns the
corresponding module object.
Pseudo-code for Python's new import logic, therefore, looks something like this
...
...
@@ -932,7 +932,7 @@ Or use slice objects directly in subscripts::
[0, 2, 4]
To simplify implementing sequences that support extended slicing, slice objects
now have a method
:meth:`indices(length)
` which, given the length of a sequence,
now have a method
``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
...
...
@@ -981,7 +981,7 @@ Here are all of the changes that Python 2.3 makes to the core Python language.
* Built-in types now support the extended slicing syntax, as described in
section :ref:`section-slices` of this document.
* A new built-in function,
:func:`sum(iterable, start=0)
`, adds up the numeric
* A new built-in function,
``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.)
...
...
@@ -995,7 +995,7 @@ Here are all of the changes that Python 2.3 makes to the core Python language.
its index, now takes optional *start* and *stop* arguments to limit the search
to only part of the list.
* Dictionaries have a new method,
:meth:`pop(key[, *default*])
`, that returns
* Dictionaries have a new method,
``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. ::
...
...
@@ -1017,7 +1017,7 @@ Here are all of the changes that Python 2.3 makes to the core Python language.
{}
>>>
There's also a new class method,
:meth:`dict.fromkeys(iterable, value)
`, that
There's also a new class method,
``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``.
...
...
@@ -1090,7 +1090,7 @@ Here are all of the changes that Python 2.3 makes to the core Python language.
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
``sys.setcheckinterval(N)`
`. The limit can be retrieved with the new
:func:`sys.getcheckinterval` function.
* One minor but far-reaching change is that the names of extension types defined
...
...
@@ -1269,10 +1269,10 @@ complete list of changes, or look through the CVS logs for all the details.
* 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
ones as well. The :func:`DocTestSuite` function creates a
:class:`unittest.TestSuite` object from a set of :mod:`doctest` tests.
* The new
:func:`gc.get_referents(object)
` function returns a list of all the
* The new
``gc.get_referents(object)`
` function returns a list of all the
objects referenced by *object*.
* The :mod:`getopt` module gained a new function, :func:`gnu_getopt`, that
...
...
@@ -1344,8 +1344,8 @@ complete list of changes, or look through the CVS logs for all the details.
documentation for details.
(Contributed by Raymond Hettinger.)
* Two new functions in the :mod:`math` module,
:func:`degrees(rads)
` and
:func:`radians(degs)
`, convert between radians and degrees. Other functions in
* Two new functions in the :mod:`math` module,
``degrees(rads)`
` and
``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
...
...
@@ -1402,7 +1402,7 @@ complete list of changes, or look through the CVS logs for all the details.
and therefore faster performance. Setting the parser object's
:attr:`buffer_text` attribute to :const:`True` will enable buffering.
* The
:func:`sample(population, k)
` function was added to the :mod:`random`
* The
``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
...
...
@@ -1448,7 +1448,7 @@ complete list of changes, or look through the CVS logs for all the details.
encryption is not believed to be secure. If you need encryption, use one of the
several AES Python modules that are available separately.
* The :mod:`shutil` module gained a
:func:`move(src, dest)
` function that
* The :mod:`shutil` module gained a
``move(src, dest)`
` function that
recursively moves a file or directory to a new location.
* Support for more advanced POSIX signal handling was added to the :mod:`signal`
...
...
@@ -1456,7 +1456,7 @@ complete list of changes, or look through the CVS logs for all the details.
platforms.
* 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.
``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.
...
...
@@ -1477,9 +1477,9 @@ complete list of changes, or look through the CVS logs for all the details.
:program:`tar`\ -format archive files. (Contributed by Lars Gustäbel.)
* The new :mod:`textwrap` module contains functions for wrapping strings
containing paragraphs of text. The
:func:`wrap(text, width)
` function takes a
containing paragraphs of text. The
``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
the chosen width. The
``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::
...
...
@@ -1900,7 +1900,7 @@ Changes to Python's build process and to the C API include:
short int`, ``I`` for :c:type:`unsigned int`, and ``K`` for :c:type:`unsigned
long long`.
* A new function,
:c:func:`PyObject_DelItemString(mapping, char \*key)
` was added
* A new function,
``PyObject_DelItemString(mapping, char *key)`
` was added
as shorthand for ``PyObject_DelItem(mapping, PyString_New(key))``.
* File objects now manage their internal string buffer differently, increasing
...
...
Doc/whatsnew/2.4.rst
View file @
a2fe3340
...
...
@@ -37,7 +37,7 @@ PEP 218: Built-In Set Objects
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
``set(iterable)`` and ``frozenset(iterable)`
`. They provide high speed
operations for membership testing, for eliminating duplicates from sequences,
and for mathematical operations like unions, intersections, differences, and
symmetric differences. ::
...
...
@@ -346,7 +346,7 @@ returned.
PEP 322: Reverse Iteration
==========================
A new built-in function,
:func:`reversed(seq)
`, takes a sequence and returns an
A new built-in function,
``reversed(seq)`
`, takes a sequence and returns an
iterator that loops over the elements of the sequence in reverse order. ::
>>> for i in reversed(xrange(1,4)):
...
...
@@ -384,7 +384,7 @@ PEP 324: New subprocess Module
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
``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
...
...
@@ -428,8 +428,8 @@ The constructor has a number of handy options:
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
exited without pausing, or
``communicate(data)`
` to send the string *data*
to the subprocess's standard input.
``communicate(data)`
` then reads any
data that the subprocess has sent to its standard output or standard error,
returning a tuple ``(stdout_data, stderr_data)``.
...
...
@@ -746,10 +746,10 @@ numbers in the current locale.
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:
*
:c:func:`PyOS_ascii_strtod(str, ptr)` and :c:func:`PyOS_ascii_atof(str, ptr)
`
*
``PyOS_ascii_strtod(str, ptr)`` and ``PyOS_ascii_atof(str, ptr)`
`
both convert a string to a C :c:type:`double`.
*
:c:func:`PyOS_ascii_formatd(buffer, buf_len, format, d)
` converts a
*
``PyOS_ascii_formatd(buffer, buf_len, format, d)`
` converts a
:c:type:`double` to an ASCII string.
The code for these functions came from the GLib library
...
...
@@ -775,7 +775,7 @@ Here are all of the changes that Python 2.4 makes to the core Python language.
* Decorators for functions and methods were added (:pep:`318`).
* Built-in :func:`set` and :func:`frozenset` types were added (:pep:`218`).
Other new built-ins include the
:func:`reversed(seq)
` function (:pep:`322`).
Other new built-ins include the
``reversed(seq)`
` function (:pep:`322`).
* Generator expressions were added (:pep:`289`).
...
...
@@ -854,7 +854,7 @@ Here are all of the changes that Python 2.4 makes to the core Python language.
(All changes to :meth:`sort` contributed by Raymond Hettinger.)
* There is a new built-in function
:func:`sorted(iterable)
` that works like the
* There is a new built-in function
``sorted(iterable)`
` that works like the
in-place :meth:`list.sort` method but can be used in expressions. The
differences are:
...
...
@@ -895,8 +895,8 @@ Here are all of the changes that Python 2.4 makes to the core Python language.
For example, you can now run the Python profiler with ``python -m profile``.
(Contributed by Nick Coghlan.)
* The
:func:`eval(expr, globals, locals)` and :func:
`execfile(filename, globals,
locals)` functions and the ``exec`` statement now accept any mapping type
* The
``eval(expr, globals, locals)`` and `
`execfile(filename, globals,
locals)`
`
functions and the ``exec`` statement now accept any mapping type
for the *locals* parameter. Previously this had to be a regular Python
dictionary. (Contributed by Raymond Hettinger.)
...
...
@@ -1087,7 +1087,7 @@ complete list of changes, or look through the CVS logs for all the details.
Yves Dionne) and new :meth:`deleteacl` and :meth:`myrights` methods (contributed
by Arnaud Mazin).
* The :mod:`itertools` module gained a
:func:`groupby(iterable[, *func*])
`
* The :mod:`itertools` module gained a
``groupby(iterable[, *func*])`
`
function. *iterable* is something that can be iterated over to return a stream
of elements, and the optional *func* parameter is a function that takes an
element and returns a key value; if omitted, the key is simply the element
...
...
@@ -1136,7 +1136,7 @@ complete list of changes, or look through the CVS logs for all the details.
(Contributed by Hye-Shik Chang.)
* :mod:`itertools` also gained a function named
:func:`tee(iterator, N)
` that
* :mod:`itertools` also gained a function named
``tee(iterator, N)`
` that
returns *N* independent iterators that replicate *iterator*. If *N* is omitted,
the default is 2. ::
...
...
@@ -1174,7 +1174,7 @@ complete list of changes, or look through the CVS logs for all the details.
level=0, # Log all messages
format='%(levelname):%(process):%(thread):%(message)')
Other additions to the :mod:`logging` package include a
:meth:`log(level, msg)
`
Other additions to the :mod:`logging` package include a
``log(level, msg)`
`
convenience method, as well as a :class:`TimedRotatingFileHandler` class that
rotates its log files at a timed interval. The module already had
:class:`RotatingFileHandler`, which rotated logs once the file exceeded a
...
...
@@ -1193,7 +1193,7 @@ complete list of changes, or look through the CVS logs for all the details.
group or for a range of groups. (Contributed by Jürgen A. Erhard.)
* Two new functions were added to the :mod:`operator` module,
:func:`attrgetter(attr)` and :func:`itemgetter(index)
`. Both functions return
``attrgetter(attr)`` and ``itemgetter(index)`
`. Both functions return
callables that take a single argument and return the corresponding attribute or
item; these callables make excellent data extractors when used with :func:`map`
or :func:`sorted`. For example::
...
...
@@ -1220,14 +1220,14 @@ complete list of changes, or look through the CVS logs for all the details.
replacement for :func:`rfc822.formatdate`. You may want to write new e-mail
processing code with this in mind. (Change implemented by Anthony Baxter.)
* A new
:func:`urandom(n)
` function was added to the :mod:`os` module, returning
* A new
``urandom(n)`
` function was added to the :mod:`os` module, returning
a string containing *n* bytes of random data. This function provides access to
platform-specific sources of randomness such as :file:`/dev/urandom` on Linux or
the Windows CryptoAPI. (Contributed by Trevor Perrin.)
* Another new function:
:func:`os.path.lexists(path)
` returns true if the file
* Another new function:
``os.path.lexists(path)`
` returns true if the file
specified by *path* exists, whether or not it's a symbolic link. This differs
from the existing
:func:`os.path.exists(path)
` function, which returns false if
from the existing
``os.path.exists(path)`
` function, which returns false if
*path* is a symlink that points to a destination that doesn't exist.
(Contributed by Beni Cherniavsky.)
...
...
@@ -1240,7 +1240,7 @@ complete list of changes, or look through the CVS logs for all the details.
* The :mod:`profile` module can now profile C extension functions. (Contributed
by Nick Bastin.)
* The :mod:`random` module has a new method called
:meth:`getrandbits(N)
` that
* The :mod:`random` module has a new method called
``getrandbits(N)`
` that
returns a long integer *N* bits in length. The existing :meth:`randrange`
method now uses :meth:`getrandbits` where appropriate, making generation of
arbitrarily large random numbers more efficient. (Contributed by Raymond
...
...
@@ -1269,7 +1269,7 @@ complete list of changes, or look through the CVS logs for all the details.
this, but 2.4 will raise a :exc:`RuntimeError` exception.
* 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
returns a pair of connected sockets and
``getservbyport(port)`
` looks up the
service name for a given port number. (Contributed by Dave Cole and Barry
Warsaw.)
...
...
@@ -1451,11 +1451,11 @@ Some of the changes to Python's build process and to the C API are:
* 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.)
* A new function,
:c:func:`PyTuple_Pack(N, obj1, obj2, ..., objN)
`, constructs
* A new function,
``PyTuple_Pack(N, obj1, obj2, ..., objN)`
`, constructs
tuples from a variable length argument list of Python objects. (Contributed by
Raymond Hettinger.)
* A new function,
:c:func:`PyDict_Contains(d, k)
`, implements fast dictionary
* A new function,
``PyDict_Contains(d, k)`
`, implements fast dictionary
lookups without masking exceptions raised during the look-up process.
(Contributed by Raymond Hettinger.)
...
...
Doc/whatsnew/2.5.rst
View file @
a2fe3340
This diff is collapsed.
Click to expand it.
Doc/whatsnew/3.0.rst
View file @
a2fe3340
...
...
@@ -812,7 +812,7 @@ Builtins
* The :func:`round` function rounding strategy and return type have
changed. Exact halfway cases are now rounded to the nearest even
result instead of away from zero. (For example, ``round(2.5)`` now
returns ``2`` rather than ``3``.)
:func:`round(x[, n])
` now
returns ``2`` rather than ``3``.)
``round(x[, n])`
` now
delegates to ``x.__round__([n])`` instead of always returning a
float. It generally returns an integer when called with a single
argument and a value of the same type as ``x`` when called with two
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment