Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Doc/c-api/conversion.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ The following functions provide locale-independent string to number conversions.
Convert a string ``s`` to a :c:type:`double`, raising a Python
exception on failure. The set of accepted strings corresponds to
the set of strings accepted by Python's :func:`float` constructor,
except that ``s`` must not have leading or trailing whitespace.
except that ``s`` must not have leading or trailing :term:`whitespace`.
The conversion is independent of the current locale.

If ``endptr`` is ``NULL``, convert the whole string. Raise
Expand Down
6 changes: 3 additions & 3 deletions Doc/c-api/unicode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ the Python configuration.

.. c:function:: int Py_UNICODE_ISSPACE(Py_UNICODE ch)

Return ``1`` or ``0`` depending on whether *ch* is a whitespace character.
Return ``1`` or ``0`` depending on whether *ch* is a :term:`whitespace` character.


.. c:function:: int Py_UNICODE_ISLOWER(Py_UNICODE ch)
Expand Down Expand Up @@ -1287,7 +1287,7 @@ These are the UTF-7 codec APIs:

If *base64SetO* is nonzero, "Set O" (punctuation that has no otherwise
special meaning) will be encoded in base-64. If *base64WhiteSpace* is
nonzero, whitespace will be encoded in base-64. Both are set to zero for the
nonzero, :term:`whitespace` will be encoded in base-64. Both are set to zero for the
Python "utf-7" codec.

.. deprecated-removed:: 3.3 4.0
Expand Down Expand Up @@ -1576,7 +1576,7 @@ They all return *NULL* or ``-1`` if an exception occurs.
.. c:function:: PyObject* PyUnicode_Split(PyObject *s, PyObject *sep, Py_ssize_t maxsplit)

Split a string giving a list of Unicode strings. If *sep* is *NULL*, splitting
will be done at all whitespace substrings. Otherwise, splits occur at the given
will be done at all :term:`whitespace` substrings. Otherwise, splits occur at the given
separator. At most *maxsplit* splits will be done. If negative, no limit is
set. Separators are not included in the resulting list.

Expand Down
4 changes: 2 additions & 2 deletions Doc/distutils/apiref.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1559,7 +1559,7 @@ lines, and joining lines with backslashes.
commonly want to do when processing a text file that has some line-by-line
syntax: strip comments (as long as ``#`` is your comment character), skip blank
lines, join adjacent lines by escaping the newline (ie. backslash at end of
line), strip leading and/or trailing whitespace. All of these are optional and
line), strip leading and/or trailing :term:`whitespace`. All of these are optional and
independently controllable.

The class provides a :meth:`warn` method so you can generate warning messages
Expand Down Expand Up @@ -1675,7 +1675,7 @@ lines, and joining lines with backslashes.
Push *line* (a string) onto an internal buffer that will be checked by future
:meth:`readline` calls. Handy for implementing a parser with line-at-a-time
lookahead. Note that lines that are "unread" with :meth:`unreadline` are not
subsequently re-cleansed (whitespace stripped, or whatever) when read with
subsequently re-cleansed (:term:`whitespace` stripped, or whatever) when read with
:meth:`readline`. If multiple calls are made to :meth:`unreadline` before a call
to :meth:`readline`, the lines will be returned most in most recent first order.

Expand Down
2 changes: 1 addition & 1 deletion Doc/distutils/configfile.rst
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ own :file:`setup.cfg`:
doc/
examples/

Note that the ``doc_files`` option is simply a whitespace-separated string
Note that the ``doc_files`` option is simply a :term:`whitespace`-separated string
split across multiple lines for readability.


Expand Down
2 changes: 1 addition & 1 deletion Doc/distutils/setupscript.rst
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ number. The accepted comparison operators are::
<= >= !=

These can be combined by using multiple qualifiers separated by commas (and
optional whitespace). In this case, all of the qualifiers must be matched; a
optional :term:`whitespace`). In this case, all of the qualifiers must be matched; a
logical AND is used to combine the evaluations.

Let's look at a bunch of examples:
Expand Down
4 changes: 2 additions & 2 deletions Doc/faq/programming.rst
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,7 @@ Is there an equivalent to Perl's chomp() for removing trailing newlines from str

You can use ``S.rstrip("\r\n")`` to remove all occurrences of any line
terminator from the end of the string ``S`` without removing other trailing
whitespace. If the string ``S`` represents more than one line, with several
:term:`whitespace`. If the string ``S`` represents more than one line, with several
empty lines at the end, the line terminators for all the blank lines will
be removed::

Expand All @@ -997,7 +997,7 @@ Is there a scanf() or sscanf() equivalent?
Not as such.

For simple input parsing, the easiest approach is usually to split the line into
whitespace-delimited words using the :meth:`~str.split` method of string objects
:term:`whitespace`-delimited words using the :meth:`~str.split` method of string objects
and then convert decimal strings to numeric values using :func:`int` or
:func:`float`. ``split()`` supports an optional "sep" parameter which is useful
if the line uses something other than whitespace as a separator.
Expand Down
2 changes: 1 addition & 1 deletion Doc/faq/windows.rst
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ this respect, and is easily configured to use spaces: Take :menuselection:`Tools
size" to 4, and select the "Insert spaces" radio button.

Python raises :exc:`IndentationError` or :exc:`TabError` if mixed tabs
and spaces are causing problems in leading whitespace.
and spaces are causing problems in leading :term:`whitespace`.
You may also run the :mod:`tabnanny` module to check a directory tree
in batch mode.

Expand Down
11 changes: 11 additions & 0 deletions Doc/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1144,6 +1144,17 @@ Glossary
A computer defined entirely in software. Python's virtual machine
executes the :term:`bytecode` emitted by the bytecode compiler.

whitespace
Characters that represent horizontal or vertical space.
In ASCII context, Python recognizes these characters as whitespace: space and
``\t\n\v\f\r`` (tab, newline, vertical tab, form feed, carriage return).

In Unicode context, whitespace characters are those
characters defined in the Unicode character database as "Other" or "Separator"
and those with bidirectional property being one of "WS", "B", or "S".

This is used, for example, to split or strip strings.

Zen of Python
Listing of Python design principles and philosophies that are helpful in
understanding and using the language. The listing can be found by typing
Expand Down
2 changes: 1 addition & 1 deletion Doc/howto/functional.rst
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ Generator expressions and list comprehensions
Two common operations on an iterator's output are 1) performing some operation
for every element, 2) selecting a subset of elements that meet some condition.
For example, given a list of strings, you might want to strip off trailing
whitespace from each line or extract all the strings containing a given
:term:`whitespace` from each line or extract all the strings containing a given
substring.

List comprehensions and generator expressions (short form: "listcomps" and
Expand Down
14 changes: 7 additions & 7 deletions Doc/howto/regex.rst
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ meaning: ``\[`` or ``\\``.
Some of the special sequences beginning with ``'\'`` represent
predefined sets of characters that are often useful, such as the set
of digits, the set of letters, or the set of anything that isn't
whitespace.
:term:`whitespace`.

Let's take an example: ``\w`` matches any alphanumeric character. If
the regex pattern is expressed in bytes, this is equivalent to the
Expand All @@ -134,11 +134,11 @@ category in the Unicode database.
Matches any non-digit character; this is equivalent to the class ``[^0-9]``.

``\s``
Matches any whitespace character; this is equivalent to the class ``[
Matches any :term:`whitespace` character; this is equivalent to the class ``[
\t\n\r\f\v]``.

``\S``
Matches any non-whitespace character; this is equivalent to the class ``[^
Matches any non-:term:`whitespace` character; this is equivalent to the class ``[^
\t\n\r\f\v]``.

``\w``
Expand All @@ -150,7 +150,7 @@ category in the Unicode database.
``[^a-zA-Z0-9_]``.

These sequences can be included inside a character class. For example,
``[\s,.]`` is a character class that will match any whitespace character, or
``[\s,.]`` is a character class that will match any :term:`whitespace` character, or
``','`` or ``'.'``.

The final metacharacter in this section is ``.``. It matches anything except a
Expand Down Expand Up @@ -637,7 +637,7 @@ of each one.

This flag allows you to write regular expressions that are more readable by
granting you more flexibility in how you can format them. When this flag has
been specified, whitespace within the RE string is ignored, except when the
been specified, :term:`whitespace` within the RE string is ignored, except when the
whitespace is in a character class or preceded by an unescaped backslash; this
lets you organize and indent the RE more clearly. This flag also lets you put
comments within a RE that will be ignored by the engine; comments are marked by
Expand Down Expand Up @@ -743,7 +743,7 @@ given location, they can obviously be matched an infinite number of times.
``\b``
Word boundary. This is a zero-width assertion that matches only at the
beginning or end of a word. A word is defined as a sequence of alphanumeric
characters, so the end of a word is indicated by whitespace or a
characters, so the end of a word is indicated by :term:`whitespace` or a
non-alphanumeric character.

The following example matches ``class`` only when it's a complete word; it won't
Expand Down Expand Up @@ -1082,7 +1082,7 @@ The :meth:`~re.Pattern.split` method of a pattern splits a string apart
wherever the RE matches, returning a list of the pieces. It's similar to the
:meth:`~str.split` method of strings but provides much more generality in the
delimiters that you can split by; string :meth:`!split` only supports splitting by
whitespace or by a fixed string. As you'd expect, there's a module-level
:term:`whitespace` or by a fixed string. As you'd expect, there's a module-level
:func:`re.split` function, too.


Expand Down
2 changes: 1 addition & 1 deletion Doc/howto/unicode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ out. If you supply the :const:`re.ASCII` flag to

Similarly, ``\w`` matches a wide variety of Unicode characters but
only ``[a-zA-Z0-9_]`` in bytes or if :const:`re.ASCII` is supplied,
and ``\s`` will match either Unicode whitespace characters or
and ``\s`` will match either Unicode :term:`whitespace` characters or
``[ \t\n\r\f\v]``.


Expand Down
2 changes: 1 addition & 1 deletion Doc/library/2to3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ and off individually. They are described here in more detail.

.. 2to3fixer:: ws_comma

Removes excess whitespace from comma separated items. This fixer is
Removes excess :term:`whitespace` from comma separated items. This fixer is
optional.

.. 2to3fixer:: xrange
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/argparse.rst
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ should not be line-wrapped::
optional arguments:
-h, --help show this help message and exit

:class:`RawTextHelpFormatter` maintains whitespace for all sorts of help text,
:class:`RawTextHelpFormatter` maintains :term:`whitespace` for all sorts of help text,
including argument descriptions. However, multiple new lines are replaced with
one. If you wish to preserve multiple blank lines, add spaces between the
newlines.
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/asyncio-eventloop.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1295,7 +1295,7 @@ async/await code consider using the high-level
*protocol* is an object instantiated by the *protocol_factory*.

.. note::
It is the application's responsibility to ensure that all whitespace
It is the application's responsibility to ensure that all :term:`whitespace`
and special characters are quoted appropriately to avoid `shell injection
<https://en.wikipedia.org/wiki/Shell_injection#Shell_injection>`_
vulnerabilities. The :func:`shlex.quote` function can be used to
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/asyncio-subprocess.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Creating Subprocesses

.. important::

It is the application's responsibility to ensure that all whitespace and
It is the application's responsibility to ensure that all :term:`whitespace` and
special characters are quoted appropriately to avoid `shell injection
<https://en.wikipedia.org/wiki/Shell_injection#Shell_injection>`_
vulnerabilities. The :func:`shlex.quote` function can be used to properly
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/base64.rst
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ The modern interface provides:

*ignorechars* should be a :term:`bytes-like object` or ASCII string
containing characters to ignore
from the input. This should only contain whitespace characters, and by
from the input. This should only contain :term:`whitespace` characters, and by
default contains all whitespace characters in ASCII.

.. versionadded:: 3.4
Expand Down
6 changes: 3 additions & 3 deletions Doc/library/binascii.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ The :mod:`binascii` module defines the following functions:

Convert a single line of uuencoded data back to binary and return the binary
data. Lines normally contain 45 (binary) bytes, except for the last line. Line
data may be followed by whitespace.
data may be followed by :term:`whitespace`.


.. function:: b2a_uu(data, *, backtick=False)
Expand Down Expand Up @@ -79,7 +79,7 @@ The :mod:`binascii` module defines the following functions:
encoding. The return value is the converted line(s). If the optional argument
*quotetabs* is present and true, all tabs and spaces will be encoded. If the
optional argument *istext* is present and true, newlines are not encoded but
trailing whitespace will be encoded. If the optional argument *header* is
trailing :term:`whitespace` will be encoded. If the optional argument *header* is
present and true, spaces will be encoded as underscores per :rfc:`1522`. If the
optional argument *header* is present and false, newline characters will be
encoded as well; otherwise linefeed conversion might corrupt the binary data
Expand Down Expand Up @@ -182,7 +182,7 @@ The :mod:`binascii` module defines the following functions:
:exc:`Error` exception is raised.

Similar functionality (accepting only text string arguments, but more
liberal towards whitespace) is also accessible using the
liberal towards :term:`whitespace`) is also accessible using the
:meth:`bytes.fromhex` class method.

.. exception:: Error
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/cmd.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ A :class:`Cmd` instance has the following methods:
completing of commands args is done by calling :meth:`complete_foo` with
arguments *text*, *line*, *begidx*, and *endidx*. *text* is the string prefix
we are attempting to match: all returned matches must begin with it. *line* is
the current input line with leading whitespace removed, *begidx* and *endidx*
the current input line with leading :term:`whitespace` removed, *begidx* and *endidx*
are the beginning and ending indexes of the prefix text, which could be used to
provide different completion depending upon which position the argument is in.

Expand Down
2 changes: 1 addition & 1 deletion Doc/library/collections.rst
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ they add the ability to access fields by name instead of position index.

The *field_names* are a sequence of strings such as ``['x', 'y']``.
Alternatively, *field_names* can be a single string with each fieldname
separated by whitespace and/or commas, for example ``'x y'`` or ``'x, y'``.
separated by :term:`whitespace` and/or commas, for example ``'x y'`` or ``'x, y'``.

Any valid Python identifier may be used for a fieldname except for names
starting with an underscore. Valid identifiers consist of letters, digits,
Expand Down
4 changes: 2 additions & 2 deletions Doc/library/configparser.rst
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ Supported INI File Structure
A configuration file consists of sections, each led by a ``[section]`` header,
followed by key/value entries separated by a specific string (``=`` or ``:`` by
default [1]_). By default, section names are case sensitive but keys are not
[1]_. Leading and trailing whitespace is removed from keys and values.
[1]_. Leading and trailing :term:`whitespace` is removed from keys and values.
Values can be omitted, in which case the key/value delimiter may also be left
out. Values can also span multiple lines, as long as they are indented deeper
than the first line of the value. Depending on the parser's mode, blank lines
Expand Down Expand Up @@ -1154,7 +1154,7 @@ ConfigParser Objects
cfgparser = ConfigParser()
cfgparser.optionxform = str

Note that when reading configuration files, whitespace around the option
Note that when reading configuration files, :term:`whitespace` around the option
names is stripped before :meth:`optionxform` is called.


Expand Down
2 changes: 1 addition & 1 deletion Doc/library/csv.rst
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ Dialects support the following attributes:

.. attribute:: Dialect.skipinitialspace

When :const:`True`, whitespace immediately following the *delimiter* is ignored.
When :const:`True`, :term:`whitespace` immediately following the *delimiter* is ignored.
The default is :const:`False`.


Expand Down
2 changes: 1 addition & 1 deletion Doc/library/curses.ascii.rst
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ C library:

.. function:: isblank(c)

Checks for an ASCII whitespace character; space or horizontal tab.
Checks for an ASCII :term:`whitespace` character; space or horizontal tab.


.. function:: iscntrl(c)
Expand Down
4 changes: 2 additions & 2 deletions Doc/library/decimal.rst
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ Decimal objects
*value* can be an integer, string, tuple, :class:`float`, or another :class:`Decimal`
object. If no *value* is given, returns ``Decimal('0')``. If *value* is a
string, it should conform to the decimal numeric string syntax after leading
and trailing whitespace characters, as well as underscores throughout, are removed::
and trailing :term:`whitespace` characters, as well as underscores throughout, are removed::

sign ::= '+' | '-'
digit ::= '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'
Expand Down Expand Up @@ -1084,7 +1084,7 @@ In addition to the three supplied contexts, new contexts can be created with the
Decimal('4.44')

This method implements the to-number operation of the IBM specification.
If the argument is a string, no leading or trailing whitespace or
If the argument is a string, no leading or trailing :term:`whitespace` or
underscores are permitted.

.. method:: create_decimal_from_float(f)
Expand Down
4 changes: 2 additions & 2 deletions Doc/library/difflib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ diffs. For comparing directories and files, see also, the :mod:`filecmp` module.
Obershelp under the hyperbolic name "gestalt pattern matching." The idea is to
find the longest contiguous matching subsequence that contains no "junk"
elements; these "junk" elements are ones that are uninteresting in some
sense, such as blank lines or whitespace. (Handling junk is an
sense, such as blank lines or :term:`whitespace`. (Handling junk is an
extension to the Ratcliff and Obershelp algorithm.) The same
idea is then applied recursively to the pieces of the sequences to the left and
to the right of the matching subsequence. This does not yield minimal edit
Expand Down Expand Up @@ -232,7 +232,7 @@ diffs. For comparing directories and files, see also, the :mod:`filecmp` module.

*charjunk*: A function that accepts a character (a string of length 1), and
returns if the character is junk, or false if not. The default is module-level
function :func:`IS_CHARACTER_JUNK`, which filters out whitespace characters (a
function :func:`IS_CHARACTER_JUNK`, which filters out :term:`whitespace` characters (a
blank or tab; it's a bad idea to include newline in this!).

:file:`Tools/scripts/ndiff.py` is a command-line front-end to this function.
Expand Down
4 changes: 2 additions & 2 deletions Doc/library/doctest.rst
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ but doctest isn't trying to do an exact emulation of any specific Python shell.

Any expected output must immediately follow the final ``'>>> '`` or ``'... '``
line containing the code, and the expected output (if any) extends to the next
``'>>> '`` or all-whitespace line.
``'>>> '`` or all-:term:`whitespace` line.

The fine print:

Expand Down Expand Up @@ -550,7 +550,7 @@ doctest decides whether actual output matches an example's expected output:

.. data:: NORMALIZE_WHITESPACE

When specified, all sequences of whitespace (blanks and newlines) are treated as
When specified, all sequences of :term:`whitespace` are treated as
equal. Any sequence of whitespace within the expected output will match any
sequence of whitespace within the actual output. By default, whitespace must
match exactly. :const:`NORMALIZE_WHITESPACE` is especially useful when a line of
Expand Down
Loading