three additional methods and one attribute. To prevent conflicts with
field names, the method and attribute names start with an underscore.
-.. method:: somenamedtuple._make(iterable)
+.. classmethod:: somenamedtuple._make(iterable)
Class method that makes a new instance from an existing sequence or iterable.
A short usage example::
>>> import csv
- >>> spamReader = csv.reader(open('eggs.csv'), delimiter=' ', quotechar='|')
+ >>> spamReader = csv.reader(open('eggs.csv', 'rb'), delimiter=' ', quotechar='|')
>>> for row in spamReader:
... print ', '.join(row)
Spam, Spam, Spam, Spam, Spam, Baked Beans
A short usage example::
>>> import csv
- >>> spamWriter = csv.writer(open('eggs.csv', 'w'), delimiter=' ',
+ >>> spamWriter = csv.writer(open('eggs.csv', 'wb'), delimiter=' ',
... quotechar='|', quoting=csv.QUOTE_MINIMAL)
>>> spamWriter.writerow(['Spam'] * 5 + ['Baked Beans'])
>>> spamWriter.writerow(['Spam', 'Lovely Spam', 'Wonderful Spam'])
An example for :class:`Sniffer` use::
- csvfile = open("example.csv")
+ csvfile = open("example.csv", "rb")
dialect = csv.Sniffer().sniff(csvfile.read(1024))
csvfile.seek(0)
reader = csv.reader(csvfile, dialect)
:synopsis: Disassembler for Python bytecode.
-The :mod:`dis` module supports the analysis of Python :term:`bytecode` by disassembling
-it. Since there is no Python assembler, this module defines the Python assembly
-language. The Python bytecode which this module takes as an input is defined
-in the file :file:`Include/opcode.h` and used by the compiler and the
-interpreter.
+The :mod:`dis` module supports the analysis of CPython :term:`bytecode` by
+disassembling it. The CPython bytecode which this module takes as an
+input is defined in the file :file:`Include/opcode.h` and used by the compiler
+and the interpreter.
+
+.. impl-detail::
+
+ Bytecode is an implementation detail of the CPython interpreter! No
+ guarantees are made that bytecode will not be added, removed, or changed
+ between versions of Python. Use of this module should not be considered to
+ work across Python VMs or Python releases.
Example: Given the function :func:`myfunc`::
This function is intended for low-level I/O. For normal usage, use the
built-in function :func:`open`, which returns a "file object" with
- :meth:`~file.read` and :meth:`~file.wprite` methods (and many more). To
+ :meth:`~file.read` and :meth:`~file.write` methods (and many more). To
wrap a file descriptor in a "file object", use :func:`fdopen`.
The :mod:`subprocess` module provides more powerful facilities for spawning new
processes and retrieving their results; using that module is preferable to using
- this function. Use the :mod:`subprocess` module. Check especially the
- :ref:`subprocess-replacements` section.
+ this function. See the
+ :ref:`subprocess-replacements` section in the :mod:`subprocess` documentation
+ for some helpful recipes.
Availability: Unix, Windows.
.. method:: str.capitalize()
- Return a copy of the string with only its first character capitalized.
+ Return a copy of the string with its first character capitalized and the
+ rest lowercased.
For 8-bit strings, this method is locale-dependent.
:synopsis: Regression tests package containing the testing suite for Python.
.. sectionauthor:: Brett Cannon <brett@python.org>
+.. note::
+ The :mod:`test` package is meant for internal use by Python only. It is
+ documented for the benefit of the core developers of Python. Any use of
+ this package outside of Python's standard library is discouraged as code
+ mentioned here can change or be removed without notice between releases of
+ Python.
+
The :mod:`test` package contains all regression tests for Python as well as the
modules :mod:`test.test_support` and :mod:`test.regrtest`.
Return whether the thread is alive.
- Roughly, a thread is alive from the moment the :meth:`start` method
- returns until its :meth:`run` method terminates. The module function
+ This method returns ``True`` just before the :meth:`run` method starts
+ until just after the :meth:`run` method terminates. The module function
:func:`.enumerate` returns a list of all alive threads.
.. method:: isDaemon()
Documentation
-------------
+- Issue #9255: Document that the 'test' package is for internal Python use
+ only.
+
- Issue #8909: Added the size of the bitmap used in the installer created by
distutils' bdist_wininst. Patch by Anatoly Techtonik.