From c33899bd713d2194c75802a543d0b350cb3bb276 Mon Sep 17 00:00:00 2001 From: Chris Jerdonek Date: Thu, 11 Oct 2012 18:57:48 -0700 Subject: [PATCH 1/2] Add and adjust some string-related links in the docs. --- Doc/library/functions.rst | 11 +++++------ Doc/library/stdtypes.rst | 8 ++++---- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index e9691948674..d6a8d0c5b84 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -1206,7 +1206,8 @@ are always available. They are listed here in alphabetical order. .. function:: str(object='') str(object[, encoding[, errors]]) - Return a string version of an object, using one of the following modes: + Return a :ref:`string ` version of an object, using one of the + following modes: If *encoding* and/or *errors* are given, :func:`str` will decode the *object* which can either be a byte string or a character buffer using @@ -1229,11 +1230,9 @@ are always available. They are listed here in alphabetical order. Objects can specify what ``str(object)`` returns by defining a :meth:`__str__` special method. - For more information on strings see :ref:`typesseq` which describes sequence - functionality (strings are sequences), and also the string-specific methods - described in the :ref:`string-methods` section. To output formatted strings, - see the :ref:`string-formatting` section. In addition see the - :ref:`stringservices` section. + For more information on strings and string methods, see the :ref:`textseq` + section. To output formatted strings, see the :ref:`string-formatting` + section. In addition, see the :ref:`stringservices` section. .. function:: sum(iterable[, start]) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index ed5b3aeb62e..759206bcb80 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -1357,8 +1357,8 @@ Text Sequence Type --- :class:`str` object: io.StringIO -Textual data in Python is handled with :class:`str` objects, which are -immutable sequences of Unicode code points. String literals are +Textual data in Python is handled with ``str`` objects, which are immutable +:ref:`sequences ` of Unicode code points. String literals are written in a variety of ways: * Single quotes: ``'allows embedded "double" quotes'`` @@ -1376,8 +1376,8 @@ See :ref:`strings` for more about the various forms of string literal, including supported escape sequences, and the ``r`` ("raw") prefix that disables most escape sequence processing. -Strings may also be created from other objects with the :ref:`str ` -built-in. +Strings may also be created from other objects with the built-in +function :func:`str`. Since there is no separate "character" type, indexing a string produces strings of length 1. That is, for a non-empty string *s*, ``s[0] == s[0:1]``. From a6229e6ebd82a36ea9c27e9361e4e67e24a8de5b Mon Sep 17 00:00:00 2001 From: Ezio Melotti Date: Fri, 12 Oct 2012 10:59:14 +0300 Subject: [PATCH 2/2] Fix and add more links. --- Doc/howto/unicode.rst | 2 +- Doc/library/functions.rst | 14 +++++++++++--- Doc/library/string.rst | 2 +- Doc/tutorial/introduction.rst | 2 +- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Doc/howto/unicode.rst b/Doc/howto/unicode.rst index f9eeae4c027..5d9e0275274 100644 --- a/Doc/howto/unicode.rst +++ b/Doc/howto/unicode.rst @@ -414,7 +414,7 @@ References ---------- The ``str`` type is described in the Python library reference at -:ref:`typesseq`. +:ref:`textseq`. The documentation for the :mod:`unicodedata` module. diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index d6a8d0c5b84..0e836f9d075 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -122,6 +122,8 @@ are always available. They are listed here in alphabetical order. Without an argument, an array of size 0 is created. + See also :ref:`binaryseq` and :ref:`typebytearray`. + .. _func-bytes: .. function:: bytes([source[, encoding[, errors]]]) @@ -135,6 +137,8 @@ are always available. They are listed here in alphabetical order. Bytes objects can also be created with literals, see :ref:`strings`. + See also :ref:`binaryseq`, :ref:`typebytes`, and :ref:`bytes-methods`. + .. function:: callable(object) @@ -687,6 +691,8 @@ are always available. They are listed here in alphabetical order. method; if the value returned is equal to *sentinel*, :exc:`StopIteration` will be raised, otherwise the value will be returned. + See also :ref:`typeiter`. + One useful application of the second form of :func:`iter` is to read lines of a file until a certain line is reached. The following example reads a file until the :meth:`readline` method returns an empty string:: @@ -707,7 +713,7 @@ are always available. They are listed here in alphabetical order. :noindex: Rather than being a function, :class:`list` is actually a mutable - sequence type, as documented in :ref:`typesseq`. + sequence type, as documented in :ref:`typesseq-list` and :ref:`typesseq`. .. function:: locals() @@ -1081,7 +1087,7 @@ are always available. They are listed here in alphabetical order. :noindex: Rather than being a function, :class:`range` is actually an immutable - sequence type, as documented in :ref:`typesseq`. + sequence type, as documented in :ref:`typesseq-range` and :ref:`typesseq`. .. function:: repr(object) @@ -1309,7 +1315,7 @@ are always available. They are listed here in alphabetical order. :noindex: Rather than being a function, :class:`tuple` is actually an immutable - sequence type, as documented in :ref:`typesseq`. + sequence type, as documented in :ref:`typesseq-tuple` and :ref:`typesseq`. .. function:: type(object) @@ -1342,6 +1348,8 @@ are always available. They are listed here in alphabetical order. ... >>> X = type('X', (object,), dict(a=1)) + See also :ref:`bltin-type-objects`. + .. function:: vars([object]) diff --git a/Doc/library/string.rst b/Doc/library/string.rst index 79d4e3f47aa..9c6327207bc 100644 --- a/Doc/library/string.rst +++ b/Doc/library/string.rst @@ -10,7 +10,7 @@ .. seealso:: - :ref:`typesseq` + :ref:`textseq` :ref:`string-methods` diff --git a/Doc/tutorial/introduction.rst b/Doc/tutorial/introduction.rst index b6d94accfdd..c07a668ccb9 100644 --- a/Doc/tutorial/introduction.rst +++ b/Doc/tutorial/introduction.rst @@ -390,7 +390,7 @@ The built-in function :func:`len` returns the length of a string:: .. seealso:: - :ref:`typesseq` + :ref:`textseq` Strings are examples of *sequence types*, and support the common operations supported by such types.