Commit 26d936a7 authored by Serhiy Storchaka's avatar Serhiy Storchaka

Issue #19795: Improved markup of True/False constants.

parent 71142c4e
...@@ -743,8 +743,8 @@ the constructed list's ``.sort()`` method. :: ...@@ -743,8 +743,8 @@ the constructed list's ``.sort()`` method. ::
Python wiki at http://wiki.python.org/moin/HowTo/Sorting.) Python wiki at http://wiki.python.org/moin/HowTo/Sorting.)
The ``any(iter)`` and ``all(iter)`` built-ins look at the truth values of an The ``any(iter)`` and ``all(iter)`` built-ins look at the truth values of an
iterable's contents. :func:`any` returns True if any element in the iterable is iterable's contents. :func:`any` returns ``True`` if any element in the iterable is
a true value, and :func:`all` returns True if all of the elements are true a true value, and :func:`all` returns ``True`` if all of the elements are true
values: values:
>>> any([0,1,0]) >>> any([0,1,0])
......
...@@ -257,6 +257,6 @@ and classes for traversing abstract syntax trees: ...@@ -257,6 +257,6 @@ and classes for traversing abstract syntax trees:
Return a formatted dump of the tree in *node*. This is mainly useful for Return a formatted dump of the tree in *node*. This is mainly useful for
debugging purposes. The returned string will show the names and the values debugging purposes. The returned string will show the names and the values
for fields. This makes the code impossible to evaluate, so if evaluation is for fields. This makes the code impossible to evaluate, so if evaluation is
wanted *annotate_fields* must be set to False. Attributes such as line wanted *annotate_fields* must be set to ``False``. Attributes such as line
numbers and column offsets are not dumped by default. If this is wanted, numbers and column offsets are not dumped by default. If this is wanted,
*include_attributes* can be set to ``True``. *include_attributes* can be set to ``True``.
...@@ -186,17 +186,17 @@ The :mod:`bdb` module also defines two classes: ...@@ -186,17 +186,17 @@ The :mod:`bdb` module also defines two classes:
.. method:: user_line(frame) .. method:: user_line(frame)
This method is called from :meth:`dispatch_line` when either This method is called from :meth:`dispatch_line` when either
:meth:`stop_here` or :meth:`break_here` yields True. :meth:`stop_here` or :meth:`break_here` yields ``True``.
.. method:: user_return(frame, return_value) .. method:: user_return(frame, return_value)
This method is called from :meth:`dispatch_return` when :meth:`stop_here` This method is called from :meth:`dispatch_return` when :meth:`stop_here`
yields True. yields ``True``.
.. method:: user_exception(frame, exc_info) .. method:: user_exception(frame, exc_info)
This method is called from :meth:`dispatch_exception` when This method is called from :meth:`dispatch_exception` when
:meth:`stop_here` yields True. :meth:`stop_here` yields ``True``.
.. method:: do_clear(arg) .. method:: do_clear(arg)
...@@ -237,7 +237,7 @@ The :mod:`bdb` module also defines two classes: ...@@ -237,7 +237,7 @@ The :mod:`bdb` module also defines two classes:
.. method:: set_quit() .. method:: set_quit()
Set the :attr:`quitting` attribute to True. This raises :exc:`BdbQuit` in Set the :attr:`quitting` attribute to ``True``. This raises :exc:`BdbQuit` in
the next call to one of the :meth:`dispatch_\*` methods. the next call to one of the :meth:`dispatch_\*` methods.
......
...@@ -98,7 +98,7 @@ The following classes are provided: ...@@ -98,7 +98,7 @@ The following classes are provided:
Netscape and RFC 2965 cookies. By default, RFC 2109 cookies (ie. cookies Netscape and RFC 2965 cookies. By default, RFC 2109 cookies (ie. cookies
received in a :mailheader:`Set-Cookie` header with a version cookie-attribute of received in a :mailheader:`Set-Cookie` header with a version cookie-attribute of
1) are treated according to the RFC 2965 rules. However, if RFC 2965 handling 1) are treated according to the RFC 2965 rules. However, if RFC 2965 handling
is turned off or :attr:`rfc2109_as_netscape` is True, RFC 2109 cookies are is turned off or :attr:`rfc2109_as_netscape` is ``True``, RFC 2109 cookies are
'downgraded' by the :class:`CookieJar` instance to Netscape cookies, by 'downgraded' by the :class:`CookieJar` instance to Netscape cookies, by
setting the :attr:`version` attribute of the :class:`Cookie` instance to 0. setting the :attr:`version` attribute of the :class:`Cookie` instance to 0.
:class:`DefaultCookiePolicy` also provides some parameters to allow some :class:`DefaultCookiePolicy` also provides some parameters to allow some
...@@ -652,7 +652,7 @@ internal consistency, so you should know what you're doing if you do that. ...@@ -652,7 +652,7 @@ internal consistency, so you should know what you're doing if you do that.
.. attribute:: Cookie.secure .. attribute:: Cookie.secure
True if cookie should only be returned over a secure connection. ``True`` if cookie should only be returned over a secure connection.
.. attribute:: Cookie.expires .. attribute:: Cookie.expires
...@@ -663,7 +663,7 @@ internal consistency, so you should know what you're doing if you do that. ...@@ -663,7 +663,7 @@ internal consistency, so you should know what you're doing if you do that.
.. attribute:: Cookie.discard .. attribute:: Cookie.discard
True if this is a session cookie. ``True`` if this is a session cookie.
.. attribute:: Cookie.comment .. attribute:: Cookie.comment
...@@ -680,7 +680,7 @@ internal consistency, so you should know what you're doing if you do that. ...@@ -680,7 +680,7 @@ internal consistency, so you should know what you're doing if you do that.
.. attribute:: Cookie.rfc2109 .. attribute:: Cookie.rfc2109
True if this cookie was received as an RFC 2109 cookie (ie. the cookie ``True`` if this cookie was received as an RFC 2109 cookie (ie. the cookie
arrived in a :mailheader:`Set-Cookie` header, and the value of the Version arrived in a :mailheader:`Set-Cookie` header, and the value of the Version
cookie-attribute in that header was 1). This attribute is provided because cookie-attribute in that header was 1). This attribute is provided because
:mod:`cookielib` may 'downgrade' RFC 2109 cookies to Netscape cookies, in :mod:`cookielib` may 'downgrade' RFC 2109 cookies to Netscape cookies, in
...@@ -691,18 +691,18 @@ internal consistency, so you should know what you're doing if you do that. ...@@ -691,18 +691,18 @@ internal consistency, so you should know what you're doing if you do that.
.. attribute:: Cookie.port_specified .. attribute:: Cookie.port_specified
True if a port or set of ports was explicitly specified by the server (in the ``True`` if a port or set of ports was explicitly specified by the server (in the
:mailheader:`Set-Cookie` / :mailheader:`Set-Cookie2` header). :mailheader:`Set-Cookie` / :mailheader:`Set-Cookie2` header).
.. attribute:: Cookie.domain_specified .. attribute:: Cookie.domain_specified
True if a domain was explicitly specified by the server. ``True`` if a domain was explicitly specified by the server.
.. attribute:: Cookie.domain_initial_dot .. attribute:: Cookie.domain_initial_dot
True if the domain explicitly specified by the server began with a dot ``True`` if the domain explicitly specified by the server began with a dot
(``'.'``). (``'.'``).
Cookies may have additional non-standard cookie-attributes. These may be Cookies may have additional non-standard cookie-attributes. These may be
...@@ -729,7 +729,7 @@ The :class:`Cookie` class also defines the following method: ...@@ -729,7 +729,7 @@ The :class:`Cookie` class also defines the following method:
.. method:: Cookie.is_expired([now=None]) .. method:: Cookie.is_expired([now=None])
True if cookie has passed the time at which the server requested it should ``True`` if cookie has passed the time at which the server requested it should
expire. If *now* is given (in seconds since the epoch), return whether the expire. If *now* is given (in seconds since the epoch), return whether the
cookie has expired at the specified time. cookie has expired at the specified time.
......
...@@ -2351,7 +2351,7 @@ These are the fundamental ctypes data types: ...@@ -2351,7 +2351,7 @@ These are the fundamental ctypes data types:
.. class:: c_bool .. class:: c_bool
Represent the C :c:type:`bool` datatype (more accurately, :c:type:`_Bool` from Represent the C :c:type:`bool` datatype (more accurately, :c:type:`_Bool` from
C99). Its value can be True or False, and the constructor accepts any object C99). Its value can be ``True`` or ``False``, and the constructor accepts any object
that has a truth value. that has a truth value.
.. versionadded:: 2.6 .. versionadded:: 2.6
......
...@@ -68,7 +68,7 @@ Here are the methods of the :class:`Message` class: ...@@ -68,7 +68,7 @@ Here are the methods of the :class:`Message` class:
Return ``True`` if the message's payload is a list of sub-\ Return ``True`` if the message's payload is a list of sub-\
:class:`Message` objects, otherwise return ``False``. When :class:`Message` objects, otherwise return ``False``. When
:meth:`is_multipart` returns False, the payload should be a string object. :meth:`is_multipart` returns ``False``, the payload should be a string object.
.. method:: set_unixfrom(unixfrom) .. method:: set_unixfrom(unixfrom)
......
...@@ -47,7 +47,7 @@ available. They are listed here in alphabetical order. ...@@ -47,7 +47,7 @@ available. They are listed here in alphabetical order.
.. function:: all(iterable) .. function:: all(iterable)
Return True if all elements of the *iterable* are true (or if the iterable Return ``True`` if all elements of the *iterable* are true (or if the iterable
is empty). Equivalent to:: is empty). Equivalent to::
def all(iterable): def all(iterable):
...@@ -61,8 +61,8 @@ available. They are listed here in alphabetical order. ...@@ -61,8 +61,8 @@ available. They are listed here in alphabetical order.
.. function:: any(iterable) .. function:: any(iterable)
Return True if any element of the *iterable* is true. If the iterable Return ``True`` if any element of the *iterable* is true. If the iterable
is empty, return False. Equivalent to:: is empty, return ``False``. Equivalent to::
def any(iterable): def any(iterable):
for element in iterable: for element in iterable:
......
...@@ -142,8 +142,8 @@ The :mod:`gc` module provides the following functions: ...@@ -142,8 +142,8 @@ The :mod:`gc` module provides the following functions:
.. function:: is_tracked(obj) .. function:: is_tracked(obj)
Returns True if the object is currently tracked by the garbage collector, Returns ``True`` if the object is currently tracked by the garbage collector,
False otherwise. As a general rule, instances of atomic types aren't ``False`` otherwise. As a general rule, instances of atomic types aren't
tracked and instances of non-atomic types (containers, user-defined tracked and instances of non-atomic types (containers, user-defined
objects...) are. However, some type-specific optimizations can be present objects...) are. However, some type-specific optimizations can be present
in order to suppress the garbage collector footprint of simple instances in order to suppress the garbage collector footprint of simple instances
......
...@@ -278,7 +278,7 @@ I/O Base Classes ...@@ -278,7 +278,7 @@ I/O Base Classes
.. method:: readable() .. method:: readable()
Return ``True`` if the stream can be read from. If False, :meth:`read` Return ``True`` if the stream can be read from. If ``False``, :meth:`read`
will raise :exc:`IOError`. will raise :exc:`IOError`.
.. method:: readline(limit=-1) .. method:: readline(limit=-1)
......
...@@ -52,8 +52,8 @@ Iterator Arguments Results ...@@ -52,8 +52,8 @@ Iterator Arguments Results
:func:`compress` data, selectors (d[0] if s[0]), (d[1] if s[1]), ... ``compress('ABCDEF', [1,0,1,0,1,1]) --> A C E F`` :func:`compress` data, selectors (d[0] if s[0]), (d[1] if s[1]), ... ``compress('ABCDEF', [1,0,1,0,1,1]) --> A C E F``
:func:`dropwhile` pred, seq seq[n], seq[n+1], starting when pred fails ``dropwhile(lambda x: x<5, [1,4,6,4,1]) --> 6 4 1`` :func:`dropwhile` pred, seq seq[n], seq[n+1], starting when pred fails ``dropwhile(lambda x: x<5, [1,4,6,4,1]) --> 6 4 1``
:func:`groupby` iterable[, keyfunc] sub-iterators grouped by value of keyfunc(v) :func:`groupby` iterable[, keyfunc] sub-iterators grouped by value of keyfunc(v)
:func:`ifilter` pred, seq elements of seq where pred(elem) is True ``ifilter(lambda x: x%2, range(10)) --> 1 3 5 7 9`` :func:`ifilter` pred, seq elements of seq where pred(elem) is true ``ifilter(lambda x: x%2, range(10)) --> 1 3 5 7 9``
:func:`ifilterfalse` pred, seq elements of seq where pred(elem) is False ``ifilterfalse(lambda x: x%2, range(10)) --> 0 2 4 6 8`` :func:`ifilterfalse` pred, seq elements of seq where pred(elem) is false ``ifilterfalse(lambda x: x%2, range(10)) --> 0 2 4 6 8``
:func:`islice` seq, [start,] stop [, step] elements from seq[start:stop:step] ``islice('ABCDEFG', 2, None) --> C D E F G`` :func:`islice` seq, [start,] stop [, step] elements from seq[start:stop:step] ``islice('ABCDEFG', 2, None) --> C D E F G``
:func:`imap` func, p, q, ... func(p0, q0), func(p1, q1), ... ``imap(pow, (2,3,10), (5,2,3)) --> 32 9 1000`` :func:`imap` func, p, q, ... func(p0, q0), func(p1, q1), ... ``imap(pow, (2,3,10), (5,2,3)) --> 32 9 1000``
:func:`starmap` func, seq func(\*seq[0]), func(\*seq[1]), ... ``starmap(pow, [(2,5), (3,2), (10,3)]) --> 32 9 1000`` :func:`starmap` func, seq func(\*seq[0]), func(\*seq[1]), ... ``starmap(pow, [(2,5), (3,2), (10,3)]) --> 32 9 1000``
......
...@@ -127,7 +127,7 @@ the :mod:`glob` module.) ...@@ -127,7 +127,7 @@ the :mod:`glob` module.)
.. versionadded:: 1.5.2 .. versionadded:: 1.5.2
.. versionchanged:: 2.3 .. versionchanged:: 2.3
If :func:`os.stat_float_times` returns True, the result is a floating point If :func:`os.stat_float_times` returns ``True``, the result is a floating point
number. number.
...@@ -140,7 +140,7 @@ the :mod:`glob` module.) ...@@ -140,7 +140,7 @@ the :mod:`glob` module.)
.. versionadded:: 1.5.2 .. versionadded:: 1.5.2
.. versionchanged:: 2.3 .. versionchanged:: 2.3
If :func:`os.stat_float_times` returns True, the result is a floating point If :func:`os.stat_float_times` returns ``True``, the result is a floating point
number. number.
...@@ -345,7 +345,7 @@ the :mod:`glob` module.) ...@@ -345,7 +345,7 @@ the :mod:`glob` module.)
.. data:: supports_unicode_filenames .. data:: supports_unicode_filenames
True if arbitrary Unicode strings can be used as file names (within limitations ``True`` if arbitrary Unicode strings can be used as file names (within limitations
imposed by the file system). imposed by the file system).
.. versionadded:: 2.3 .. versionadded:: 2.3
......
...@@ -234,10 +234,10 @@ Module functions and constants ...@@ -234,10 +234,10 @@ Module functions and constants
.. function:: enable_callback_tracebacks(flag) .. function:: enable_callback_tracebacks(flag)
By default you will not get any tracebacks in user-defined functions, By default you will not get any tracebacks in user-defined functions,
aggregates, converters, authorizer callbacks etc. If you want to debug them, you aggregates, converters, authorizer callbacks etc. If you want to debug them,
can call this function with *flag* as True. Afterwards, you will get tracebacks you can call this function with *flag* set to ``True``. Afterwards, you will
from callbacks on ``sys.stderr``. Use :const:`False` to disable the feature get tracebacks from callbacks on ``sys.stderr``. Use :const:`False` to
again. disable the feature again.
.. _sqlite3-connection-objects: .. _sqlite3-connection-objects:
......
...@@ -166,7 +166,7 @@ Functions, Constants, and Exceptions ...@@ -166,7 +166,7 @@ Functions, Constants, and Exceptions
.. function:: RAND_status() .. function:: RAND_status()
Returns True if the SSL pseudo-random number generator has been seeded with Returns ``True`` if the SSL pseudo-random number generator has been seeded with
'enough' randomness, and False otherwise. You can use :func:`ssl.RAND_egd` 'enough' randomness, and False otherwise. You can use :func:`ssl.RAND_egd`
and :func:`ssl.RAND_add` to increase the randomness of the pseudo-random and :func:`ssl.RAND_add` to increase the randomness of the pseudo-random
number generator. number generator.
......
...@@ -1783,7 +1783,7 @@ The constructors for both classes work the same: ...@@ -1783,7 +1783,7 @@ The constructors for both classes work the same:
.. method:: isdisjoint(other) .. method:: isdisjoint(other)
Return True if the set has no elements in common with *other*. Sets are Return ``True`` if the set has no elements in common with *other*. Sets are
disjoint if and only if their intersection is the empty set. disjoint if and only if their intersection is the empty set.
.. versionadded:: 2.6 .. versionadded:: 2.6
......
...@@ -284,7 +284,7 @@ platforms use 32-bit pointers and will use a Python integer. ...@@ -284,7 +284,7 @@ platforms use 32-bit pointers and will use a Python integer.
For the ``'?'`` format character, the return value is either :const:`True` or For the ``'?'`` format character, the return value is either :const:`True` or
:const:`False`. When packing, the truth value of the argument object is used. :const:`False`. When packing, the truth value of the argument object is used.
Either 0 or 1 in the native or standard bool representation will be packed, and Either 0 or 1 in the native or standard bool representation will be packed, and
any non-zero value will be True when unpacking. any non-zero value will be ``True`` when unpacking.
......
...@@ -267,8 +267,8 @@ Besides the methods described below, the :class:`ttk.Widget` class supports the ...@@ -267,8 +267,8 @@ Besides the methods described below, the :class:`ttk.Widget` class supports the
.. method:: instate(statespec, callback=None, *args, **kw) .. method:: instate(statespec, callback=None, *args, **kw)
Test the widget's state. If a callback is not specified, returns True Test the widget's state. If a callback is not specified, returns ``True``
if the widget state matches *statespec* and False otherwise. If callback if the widget state matches *statespec* and ``False`` otherwise. If callback
is specified then it is called with *args* if widget state matches is specified then it is called with *args* if widget state matches
*statespec*. *statespec*.
...@@ -919,7 +919,7 @@ ttk.Treeview ...@@ -919,7 +919,7 @@ ttk.Treeview
.. method:: exists(item) .. method:: exists(item)
Returns True if the specified *item* is present in the tree. Returns ``True`` if the specified *item* is present in the tree.
.. method:: focus([item=None]) .. method:: focus([item=None])
...@@ -1065,7 +1065,7 @@ ttk.Treeview ...@@ -1065,7 +1065,7 @@ ttk.Treeview
Ensure that *item* is visible. Ensure that *item* is visible.
Sets all of *item*'s ancestors open option to True, and scrolls the Sets all of *item*'s ancestors open option to ``True``, and scrolls the
widget if necessary so that *item* is within the visible portion of widget if necessary so that *item* is within the visible portion of
the tree. the tree.
......
...@@ -1049,8 +1049,8 @@ More drawing control ...@@ -1049,8 +1049,8 @@ More drawing control
Write text - the string representation of *arg* - at the current turtle Write text - the string representation of *arg* - at the current turtle
position according to *align* ("left", "center" or right") and with the given position according to *align* ("left", "center" or right") and with the given
font. If *move* is True, the pen is moved to the bottom-right corner of the font. If *move* is true, the pen is moved to the bottom-right corner of the
text. By default, *move* is False. text. By default, *move* is ``False``.
>>> turtle.write("Home = ", True, align="center") >>> turtle.write("Home = ", True, align="center")
>>> turtle.write((0,0), True) >>> turtle.write((0,0), True)
...@@ -1086,7 +1086,7 @@ Visibility ...@@ -1086,7 +1086,7 @@ Visibility
.. function:: isvisible() .. function:: isvisible()
Return True if the Turtle is shown, False if it's hidden. Return ``True`` if the Turtle is shown, ``False`` if it's hidden.
>>> turtle.hideturtle() >>> turtle.hideturtle()
>>> turtle.isvisible() >>> turtle.isvisible()
......
...@@ -166,7 +166,7 @@ The following classes are provided: ...@@ -166,7 +166,7 @@ The following classes are provided:
should be the request-host of the request for the page containing the image. should be the request-host of the request for the page containing the image.
*unverifiable* should indicate whether the request is unverifiable, as defined *unverifiable* should indicate whether the request is unverifiable, as defined
by RFC 2965. It defaults to False. An unverifiable request is one whose URL by RFC 2965. It defaults to ``False``. An unverifiable request is one whose URL
the user did not have the option to approve. For example, if the request is for the user did not have the option to approve. For example, if the request is for
an image in an HTML document, and the user had no option to approve the an image in an HTML document, and the user had no option to approve the
automatic fetching of the image, this should be true. automatic fetching of the image, this should be true.
......
...@@ -115,7 +115,7 @@ zipimporter Objects ...@@ -115,7 +115,7 @@ zipimporter Objects
.. method:: is_package(fullname) .. method:: is_package(fullname)
Return True if the module specified by *fullname* is a package. Raise Return ``True`` if the module specified by *fullname* is a package. Raise
:exc:`ZipImportError` if the module couldn't be found. :exc:`ZipImportError` if the module couldn't be found.
......
...@@ -207,7 +207,7 @@ Ellipsis ...@@ -207,7 +207,7 @@ Ellipsis
single: True single: True
These represent the truth values False and True. The two objects These represent the truth values False and True. The two objects
representing the values False and True are the only Boolean objects. representing the values ``False`` and ``True`` are the only Boolean objects.
The Boolean type is a subtype of plain integers, and Boolean values The Boolean type is a subtype of plain integers, and Boolean values
behave like the values 0 and 1, respectively, in almost all contexts, behave like the values 0 and 1, respectively, in almost all contexts,
the exception being that when converted to a string, the strings the exception being that when converted to a string, the strings
......
...@@ -67,6 +67,11 @@ Tests ...@@ -67,6 +67,11 @@ Tests
- Issue #19085: Added basic tests for all tkinter widget options. - Issue #19085: Added basic tests for all tkinter widget options.
Documentation
-------------
- Issue #19795: Improved markup of True/False constants.
Whats' New in Python 2.7.6? Whats' New in Python 2.7.6?
=========================== ===========================
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment