summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorThomas Wouters <thomas@python.org>2007-09-20 18:22:40 (GMT)
committerThomas Wouters <thomas@python.org>2007-09-20 18:22:40 (GMT)
commit8ce81f767a48e9e645c523137c7f83e49f79f986 (patch)
tree68e5fa3f61af5f75d43de717a0c997db77dd2910 /Doc
parent7ce29ca41cd2c41ac7a5981d182f8db25c2af977 (diff)
downloadcpython-8ce81f767a48e9e645c523137c7f83e49f79f986.zip
cpython-8ce81f767a48e9e645c523137c7f83e49f79f986.tar.gz
cpython-8ce81f767a48e9e645c523137c7f83e49f79f986.tar.bz2
Merged revisions 58211-58220 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r58211 | facundo.batista | 2007-09-19 19:53:25 +0200 (Wed, 19 Sep 2007) | 4 lines Issue #1772851. Optimization of __hash__ to behave better for big big numbers. ........ r58216 | raymond.hettinger | 2007-09-20 05:03:43 +0200 (Thu, 20 Sep 2007) | 1 line Fit nits ........ r58217 | georg.brandl | 2007-09-20 10:44:59 +0200 (Thu, 20 Sep 2007) | 2 lines alternate -> alternative. ........ r58218 | georg.brandl | 2007-09-20 18:06:07 +0200 (Thu, 20 Sep 2007) | 2 lines Patch #1541463: optimize performance of cgi.FieldStorage operations. ........ r58219 | georg.brandl | 2007-09-20 18:45:27 +0200 (Thu, 20 Sep 2007) | 2 lines #1176: document that string methods don't take keyword args. ........ r58220 | thomas.wouters | 2007-09-20 19:35:10 +0200 (Thu, 20 Sep 2007) | 4 lines Try harder to stay within the 79-column limit. There's still two places that go (way) over, but those are harder to fix without suffering in readability. ........
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/collections.rst18
-rw-r--r--Doc/library/decimal.rst2
-rw-r--r--Doc/library/stdtypes.rst11
-rw-r--r--Doc/tutorial/inputoutput.rst2
4 files changed, 20 insertions, 13 deletions
diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst
index 227f721..274ca15 100644
--- a/Doc/library/collections.rst
+++ b/Doc/library/collections.rst
@@ -395,8 +395,8 @@ Setting the :attr:`default_factory` to :class:`set` makes the
.. _named-tuple-factory:
-:func:`NamedTuple` factory function
------------------------------------
+:func:`NamedTuple` Factory Function for Tuples with Named Fields
+----------------------------------------------------------------
Named tuples assign meaning to each position in a tuple and allow for more readable,
self-documenting code. They can be used wherever regular tuples are used, and
@@ -411,12 +411,12 @@ they add the ability to access fields by name instead of position index.
method which lists the tuple contents in a ``name=value`` format.
The *fieldnames* are specified in a single string with each fieldname separated by
- a space and/or comma. Any valid Python identifier may be used for a field name.
+ a space and/or comma. Any valid Python identifier may be used for a fieldname.
- If *verbose* is true, the *NamedTuple* call will print the class definition.
+ If *verbose* is true, will print the class definition.
*NamedTuple* instances do not have per-instance dictionaries, so they are
- lightweight, requiring no more memory than regular tuples.
+ lightweight and require no more memory than regular tuples.
Example::
@@ -467,7 +467,9 @@ an additonal method and an informational read-only attribute.
.. method:: somenamedtuple.replace(field, value)
- Return a new instance of the named tuple replacing the named *field* with a new *value*::
+ Return a new instance of the named tuple replacing the named *field* with a new *value*:
+
+::
>>> p = Point(x=11, y=22)
>>> p.__replace__('x', 33)
@@ -480,7 +482,9 @@ an additonal method and an informational read-only attribute.
Return a tuple of strings listing the field names. This is useful for introspection,
for converting a named tuple instance to a dictionary, and for combining named tuple
- types to create new named tuple types::
+ types to create new named tuple types:
+
+::
>>> p.__fields__ # view the field names
('x', 'y')
diff --git a/Doc/library/decimal.rst b/Doc/library/decimal.rst
index bbac0d4..ee4aeec 100644
--- a/Doc/library/decimal.rst
+++ b/Doc/library/decimal.rst
@@ -977,7 +977,7 @@ method. For example, ``C.exp(x)`` is equivalent to
The usual approach to working with decimals is to create :class:`Decimal`
instances and then apply arithmetic operations which take place within the
-current context for the active thread. An alternate approach is to use context
+current context for the active thread. An alternative approach is to use context
methods for calculating within a specific context. The methods are similar to
those for the :class:`Decimal` class and are only briefly recounted here.
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst
index 75db75c..1a0bdf3 100644
--- a/Doc/library/stdtypes.rst
+++ b/Doc/library/stdtypes.rst
@@ -657,10 +657,13 @@ String Methods
.. index:: pair: string; methods
-String objects support the methods listed below. In addition, Python's strings
-support the sequence type methods described in the :ref:`typesseq` section. To
-output formatted strings, see the :ref:`string-formatting` section. Also, see
-the :mod:`re` module for string functions based on regular expressions.
+String objects support the methods listed below. Note that none of these
+methods take keyword arguments.
+
+In addition, Python's strings support the sequence type methods described in
+the :ref:`typesseq` section. To output formatted strings, see the
+:ref:`string-formatting` section. Also, see the :mod:`re` module for string
+functions based on regular expressions.
.. method:: str.capitalize()
diff --git a/Doc/tutorial/inputoutput.rst b/Doc/tutorial/inputoutput.rst
index 54f4403..2f4cdd3 100644
--- a/Doc/tutorial/inputoutput.rst
+++ b/Doc/tutorial/inputoutput.rst
@@ -252,7 +252,7 @@ having to load the entire file in memory. Only complete lines will be returned.
>>> f.readlines()
['This is the first line of the file.\n', 'Second line of the file\n']
-An alternate approach to reading lines is to loop over the file object. This is
+An alternative approach to reading lines is to loop over the file object. This is
memory efficient, fast, and leads to simpler code::
>>> for line in f: