mirror of https://github.com/python/cpython
Merged revisions 76904 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r76904 | ezio.melotti | 2009-12-20 00:41:49 +0200 (Sun, 20 Dec 2009) | 1 line #7388: "python".capitalize() in the Doc ........
This commit is contained in:
parent
de52070f11
commit
2f4f2c15cb
|
@ -620,7 +620,7 @@ information is sometimes used to indicate sub-releases. These are
|
||||||
1.0.1a2
|
1.0.1a2
|
||||||
the second alpha release of the first patch version of 1.0
|
the second alpha release of the first patch version of 1.0
|
||||||
|
|
||||||
:option:`classifiers` are specified in a python list::
|
:option:`classifiers` are specified in a Python list::
|
||||||
|
|
||||||
setup(...,
|
setup(...,
|
||||||
classifiers=[
|
classifiers=[
|
||||||
|
|
|
@ -432,7 +432,7 @@ How do I find undefined g++ symbols __builtin_new or __pure_virtual?
|
||||||
--------------------------------------------------------------------
|
--------------------------------------------------------------------
|
||||||
|
|
||||||
To dynamically load g++ extension modules, you must recompile Python, relink it
|
To dynamically load g++ extension modules, you must recompile Python, relink it
|
||||||
using g++ (change LINKCC in the python Modules Makefile), and link your
|
using g++ (change LINKCC in the Python Modules Makefile), and link your
|
||||||
extension module using g++ (e.g., ``g++ -shared -o mymodule.so mymodule.o``).
|
extension module using g++ (e.g., ``g++ -shared -o mymodule.so mymodule.o``).
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ interpreter is installed on your platform.
|
||||||
|
|
||||||
If you would like the script to be independent of where the Python interpreter
|
If you would like the script to be independent of where the Python interpreter
|
||||||
lives, you can use the "env" program. Almost all Unix variants support the
|
lives, you can use the "env" program. Almost all Unix variants support the
|
||||||
following, assuming the python interpreter is in a directory on the user's
|
following, assuming the Python interpreter is in a directory on the user's
|
||||||
$PATH::
|
$PATH::
|
||||||
|
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
|
@ -204,7 +204,7 @@ The important things to remember are:
|
||||||
for developing code by experiment.
|
for developing code by experiment.
|
||||||
|
|
||||||
|
|
||||||
How do I make python scripts executable?
|
How do I make Python scripts executable?
|
||||||
----------------------------------------
|
----------------------------------------
|
||||||
|
|
||||||
On Windows 2000, the standard Python installer already associates the .py
|
On Windows 2000, the standard Python installer already associates the .py
|
||||||
|
|
|
@ -334,7 +334,7 @@ added elements by appending to the right and popping to the left::
|
||||||
yield s / float(n)
|
yield s / float(n)
|
||||||
|
|
||||||
The :meth:`rotate` method provides a way to implement :class:`deque` slicing and
|
The :meth:`rotate` method provides a way to implement :class:`deque` slicing and
|
||||||
deletion. For example, a pure python implementation of ``del d[n]`` relies on
|
deletion. For example, a pure Python implementation of ``del d[n]`` relies on
|
||||||
the :meth:`rotate` method to position elements to be popped::
|
the :meth:`rotate` method to position elements to be popped::
|
||||||
|
|
||||||
def delete_nth(d, n):
|
def delete_nth(d, n):
|
||||||
|
|
|
@ -1132,7 +1132,7 @@ capabilities, then you should use the advanced API.
|
||||||
The advanced API revolves around two container classes, which are used to store
|
The advanced API revolves around two container classes, which are used to store
|
||||||
the interactive examples extracted from doctest cases:
|
the interactive examples extracted from doctest cases:
|
||||||
|
|
||||||
* :class:`Example`: A single python :term:`statement`, paired with its expected
|
* :class:`Example`: A single Python :term:`statement`, paired with its expected
|
||||||
output.
|
output.
|
||||||
|
|
||||||
* :class:`DocTest`: A collection of :class:`Example`\ s, typically extracted
|
* :class:`DocTest`: A collection of :class:`Example`\ s, typically extracted
|
||||||
|
|
|
@ -57,5 +57,5 @@ An HMAC object has the following methods:
|
||||||
.. seealso::
|
.. seealso::
|
||||||
|
|
||||||
Module :mod:`hashlib`
|
Module :mod:`hashlib`
|
||||||
The python module providing secure hash functions.
|
The Python module providing secure hash functions.
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@ objects.
|
||||||
Example Usage
|
Example Usage
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
Note that this example runs the python "benchmark" pystones. It can take some
|
Note that this example runs the Python "benchmark" pystones. It can take some
|
||||||
time to run, and will produce large output files. ::
|
time to run, and will produce large output files. ::
|
||||||
|
|
||||||
>>> import hotshot, hotshot.stats, test.pystone
|
>>> import hotshot, hotshot.stats, test.pystone
|
||||||
|
|
|
@ -2213,7 +2213,7 @@ A Formatter can be initialized with a format string which makes use of knowledge
|
||||||
of the :class:`LogRecord` attributes - such as the default value mentioned above
|
of the :class:`LogRecord` attributes - such as the default value mentioned above
|
||||||
making use of the fact that the user's message and arguments are pre-formatted
|
making use of the fact that the user's message and arguments are pre-formatted
|
||||||
into a :class:`LogRecord`'s *message* attribute. This format string contains
|
into a :class:`LogRecord`'s *message* attribute. This format string contains
|
||||||
standard python %-style mapping keys. See section :ref:`string-formatting`
|
standard Python %-style mapping keys. See section :ref:`string-formatting`
|
||||||
for more information on string formatting.
|
for more information on string formatting.
|
||||||
|
|
||||||
Currently, the useful mapping keys in a :class:`LogRecord` are:
|
Currently, the useful mapping keys in a :class:`LogRecord` are:
|
||||||
|
|
|
@ -688,7 +688,7 @@ Miscellaneous
|
||||||
|
|
||||||
.. function:: set_executable()
|
.. function:: set_executable()
|
||||||
|
|
||||||
Sets the path of the python interpreter to use when starting a child process.
|
Sets the path of the Python interpreter to use when starting a child process.
|
||||||
(By default :data:`sys.executable` is used). Embedders will probably need to
|
(By default :data:`sys.executable` is used). Embedders will probably need to
|
||||||
do some thing like ::
|
do some thing like ::
|
||||||
|
|
||||||
|
|
|
@ -352,7 +352,7 @@ unalias *name*
|
||||||
(Pdb)
|
(Pdb)
|
||||||
|
|
||||||
run [*args* ...]
|
run [*args* ...]
|
||||||
Restart the debugged python program. If an argument is supplied, it is split
|
Restart the debugged Python program. If an argument is supplied, it is split
|
||||||
with "shlex" and the result is used as the new sys.argv. History, breakpoints,
|
with "shlex" and the result is used as the new sys.argv. History, breakpoints,
|
||||||
actions and debugger options are preserved. "restart" is an alias for "run".
|
actions and debugger options are preserved. "restart" is an alias for "run".
|
||||||
|
|
||||||
|
|
|
@ -271,7 +271,7 @@ An :class:`SMTP` instance has the following methods:
|
||||||
.. versionchanged:: 2.6
|
.. versionchanged:: 2.6
|
||||||
|
|
||||||
:exc:`RuntimeError`
|
:exc:`RuntimeError`
|
||||||
SSL/TLS support is not available to your python interpreter.
|
SSL/TLS support is not available to your Python interpreter.
|
||||||
|
|
||||||
|
|
||||||
.. method:: SMTP.sendmail(from_addr, to_addrs, msg[, mail_options, rcpt_options])
|
.. method:: SMTP.sendmail(from_addr, to_addrs, msg[, mail_options, rcpt_options])
|
||||||
|
|
|
@ -756,7 +756,7 @@ Note that the :meth:`connect` operation is subject to the timeout setting, and
|
||||||
in general it is recommended to call :meth:`settimeout` before calling
|
in general it is recommended to call :meth:`settimeout` before calling
|
||||||
:meth:`connect` or pass a timeout parameter to :meth:`create_connection`.
|
:meth:`connect` or pass a timeout parameter to :meth:`create_connection`.
|
||||||
The system network stack may return a connection timeout error
|
The system network stack may return a connection timeout error
|
||||||
of its own regardless of any python socket timeout setting.
|
of its own regardless of any Python socket timeout setting.
|
||||||
|
|
||||||
|
|
||||||
.. method:: socket.setsockopt(level, optname, value)
|
.. method:: socket.setsockopt(level, optname, value)
|
||||||
|
|
|
@ -1362,10 +1362,10 @@ The conversion types are:
|
||||||
| ``'c'`` | Single character (accepts integer or single | |
|
| ``'c'`` | Single character (accepts integer or single | |
|
||||||
| | character string). | |
|
| | character string). | |
|
||||||
+------------+-----------------------------------------------------+-------+
|
+------------+-----------------------------------------------------+-------+
|
||||||
| ``'r'`` | String (converts any python object using | \(5) |
|
| ``'r'`` | String (converts any Python object using | \(5) |
|
||||||
| | :func:`repr`). | |
|
| | :func:`repr`). | |
|
||||||
+------------+-----------------------------------------------------+-------+
|
+------------+-----------------------------------------------------+-------+
|
||||||
| ``'s'`` | String (converts any python object using | \(6) |
|
| ``'s'`` | String (converts any Python object using | \(6) |
|
||||||
| | :func:`str`). | |
|
| | :func:`str`). | |
|
||||||
+------------+-----------------------------------------------------+-------+
|
+------------+-----------------------------------------------------+-------+
|
||||||
| ``'%'`` | No argument is converted, results in a ``'%'`` | |
|
| ``'%'`` | No argument is converted, results in a ``'%'`` | |
|
||||||
|
|
|
@ -36,7 +36,7 @@ the module from within IDLE run with the ``-n`` switch.
|
||||||
|
|
||||||
The turtle module provides turtle graphics primitives, in both object-oriented
|
The turtle module provides turtle graphics primitives, in both object-oriented
|
||||||
and procedure-oriented ways. Because it uses :mod:`Tkinter` for the underlying
|
and procedure-oriented ways. Because it uses :mod:`Tkinter` for the underlying
|
||||||
graphics, it needs a version of python installed with Tk support.
|
graphics, it needs a version of Python installed with Tk support.
|
||||||
|
|
||||||
The object-oriented interface uses essentially two+two classes:
|
The object-oriented interface uses essentially two+two classes:
|
||||||
|
|
||||||
|
|
|
@ -624,7 +624,7 @@ The :mod:`uu` module contains the following notice::
|
||||||
- Use binascii module to do the actual line-by-line conversion
|
- Use binascii module to do the actual line-by-line conversion
|
||||||
between ascii and binary. This results in a 1000-fold speedup. The C
|
between ascii and binary. This results in a 1000-fold speedup. The C
|
||||||
version is still 5 times faster, though.
|
version is still 5 times faster, though.
|
||||||
- Arguments more compliant with python standard
|
- Arguments more compliant with Python standard
|
||||||
|
|
||||||
|
|
||||||
XML Remote Procedure Calls
|
XML Remote Procedure Calls
|
||||||
|
|
|
@ -306,7 +306,7 @@ sophisticated and robust capabilities of its larger packages. For example:
|
||||||
* The :mod:`xml.dom` and :mod:`xml.sax` packages provide robust support for
|
* The :mod:`xml.dom` and :mod:`xml.sax` packages provide robust support for
|
||||||
parsing this popular data interchange format. Likewise, the :mod:`csv` module
|
parsing this popular data interchange format. Likewise, the :mod:`csv` module
|
||||||
supports direct reads and writes in a common database format. Together, these
|
supports direct reads and writes in a common database format. Together, these
|
||||||
modules and packages greatly simplify data interchange between python
|
modules and packages greatly simplify data interchange between Python
|
||||||
applications and other tools.
|
applications and other tools.
|
||||||
|
|
||||||
* Internationalization is supported by a number of modules including
|
* Internationalization is supported by a number of modules including
|
||||||
|
|
|
@ -289,7 +289,7 @@ The :mod:`array` module provides an :class:`array()` object that is like a list
|
||||||
that stores only homogeneous data and stores it more compactly. The following
|
that stores only homogeneous data and stores it more compactly. The following
|
||||||
example shows an array of numbers stored as two byte unsigned binary numbers
|
example shows an array of numbers stored as two byte unsigned binary numbers
|
||||||
(typecode ``"H"``) rather than the usual 16 bytes per entry for regular lists of
|
(typecode ``"H"``) rather than the usual 16 bytes per entry for regular lists of
|
||||||
python int objects::
|
Python int objects::
|
||||||
|
|
||||||
>>> from array import array
|
>>> from array import array
|
||||||
>>> a = array('H', [4000, 10, 700, 22222])
|
>>> a = array('H', [4000, 10, 700, 22222])
|
||||||
|
|
|
@ -131,14 +131,14 @@ which searches for the Python interpreter in the whole :envvar:`PATH`. However,
|
||||||
some Unices may not have the :program:`env` command, so you may need to hardcode
|
some Unices may not have the :program:`env` command, so you may need to hardcode
|
||||||
``/usr/bin/python`` as the interpreter path.
|
``/usr/bin/python`` as the interpreter path.
|
||||||
|
|
||||||
To use shell commands in your python scripts, look at the :mod:`subprocess` module.
|
To use shell commands in your Python scripts, look at the :mod:`subprocess` module.
|
||||||
|
|
||||||
|
|
||||||
Editors
|
Editors
|
||||||
=======
|
=======
|
||||||
|
|
||||||
Vim and Emacs are excellent editors which support Python very well. For more
|
Vim and Emacs are excellent editors which support Python very well. For more
|
||||||
information on how to code in python in these editors, look at:
|
information on how to code in Python in these editors, look at:
|
||||||
|
|
||||||
* http://www.vim.org/scripts/script.php?script_id=790
|
* http://www.vim.org/scripts/script.php?script_id=790
|
||||||
* http://sourceforge.net/projects/python-mode
|
* http://sourceforge.net/projects/python-mode
|
||||||
|
|
|
@ -71,7 +71,7 @@ key features:
|
||||||
|
|
||||||
`Enthought Python Distribution <http://www.enthought.com/products/epd.php>`_
|
`Enthought Python Distribution <http://www.enthought.com/products/epd.php>`_
|
||||||
Popular modules (such as PyWin32) with their respective documentation, tool
|
Popular modules (such as PyWin32) with their respective documentation, tool
|
||||||
suite for building extensible python applications
|
suite for building extensible Python applications
|
||||||
|
|
||||||
Notice that these packages are likely to install *older* versions of Python.
|
Notice that these packages are likely to install *older* versions of Python.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue