From: Serhiy Storchaka Date: Fri, 29 Nov 2013 10:16:53 +0000 (+0200) Subject: Issue #19795: Improved markup of True/False constants. X-Git-Tag: v2.7.8~231 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=26d936a71e2aa4da5618c5d6532eac488af00ee4;p=thirdparty%2FPython%2Fcpython.git Issue #19795: Improved markup of True/False constants. --- diff --git a/Doc/howto/functional.rst b/Doc/howto/functional.rst index 836ec6da4137..0ff9eeef02e9 100644 --- a/Doc/howto/functional.rst +++ b/Doc/howto/functional.rst @@ -743,8 +743,8 @@ the constructed list's ``.sort()`` method. :: 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 -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 +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 values: >>> any([0,1,0]) diff --git a/Doc/library/ast.rst b/Doc/library/ast.rst index 4db406093650..8adc88f7da4f 100644 --- a/Doc/library/ast.rst +++ b/Doc/library/ast.rst @@ -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 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 - 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, *include_attributes* can be set to ``True``. diff --git a/Doc/library/bdb.rst b/Doc/library/bdb.rst index 1cbb8f6d5d7c..c3e1ed2ff34f 100644 --- a/Doc/library/bdb.rst +++ b/Doc/library/bdb.rst @@ -186,17 +186,17 @@ The :mod:`bdb` module also defines two classes: .. method:: user_line(frame) 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) This method is called from :meth:`dispatch_return` when :meth:`stop_here` - yields True. + yields ``True``. .. method:: user_exception(frame, exc_info) This method is called from :meth:`dispatch_exception` when - :meth:`stop_here` yields True. + :meth:`stop_here` yields ``True``. .. method:: do_clear(arg) @@ -237,7 +237,7 @@ The :mod:`bdb` module also defines two classes: .. 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. diff --git a/Doc/library/cookielib.rst b/Doc/library/cookielib.rst index 2ace5100a269..8029dec1aa94 100644 --- a/Doc/library/cookielib.rst +++ b/Doc/library/cookielib.rst @@ -98,7 +98,7 @@ The following classes are provided: 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 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 setting the :attr:`version` attribute of the :class:`Cookie` instance to 0. :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. .. 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 @@ -663,7 +663,7 @@ internal consistency, so you should know what you're doing if you do that. .. attribute:: Cookie.discard - True if this is a session cookie. + ``True`` if this is a session cookie. .. attribute:: Cookie.comment @@ -680,7 +680,7 @@ internal consistency, so you should know what you're doing if you do that. .. 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 cookie-attribute in that header was 1). This attribute is provided because :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. .. 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). .. 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 - 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 @@ -729,7 +729,7 @@ The :class:`Cookie` class also defines the following method: .. 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 cookie has expired at the specified time. diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst index 882c50a99f13..c87f862e3c4a 100644 --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -2351,7 +2351,7 @@ These are the fundamental ctypes data types: .. class:: c_bool 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. .. versionadded:: 2.6 diff --git a/Doc/library/email.message.rst b/Doc/library/email.message.rst index 5076af62b598..838bcf529aff 100644 --- a/Doc/library/email.message.rst +++ b/Doc/library/email.message.rst @@ -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-\ :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) diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index aabf2346bb56..3b3c7ddf0cf7 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -47,7 +47,7 @@ available. They are listed here in alphabetical order. .. 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:: def all(iterable): @@ -61,8 +61,8 @@ available. They are listed here in alphabetical order. .. function:: any(iterable) - Return True if any element of the *iterable* is true. If the iterable - is empty, return False. Equivalent to:: + Return ``True`` if any element of the *iterable* is true. If the iterable + is empty, return ``False``. Equivalent to:: def any(iterable): for element in iterable: diff --git a/Doc/library/gc.rst b/Doc/library/gc.rst index f02f09d7d044..be0063d8eb9f 100644 --- a/Doc/library/gc.rst +++ b/Doc/library/gc.rst @@ -142,8 +142,8 @@ The :mod:`gc` module provides the following functions: .. function:: is_tracked(obj) - Returns True if the object is currently tracked by the garbage collector, - False otherwise. As a general rule, instances of atomic types aren't + Returns ``True`` if the object is currently tracked by the garbage collector, + ``False`` otherwise. As a general rule, instances of atomic types aren't tracked and instances of non-atomic types (containers, user-defined objects...) are. However, some type-specific optimizations can be present in order to suppress the garbage collector footprint of simple instances diff --git a/Doc/library/io.rst b/Doc/library/io.rst index cc6cc95c86c4..c866c980976c 100644 --- a/Doc/library/io.rst +++ b/Doc/library/io.rst @@ -278,7 +278,7 @@ I/O Base Classes .. 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`. .. method:: readline(limit=-1) diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst index 76452811cde7..60b04b0522bc 100644 --- a/Doc/library/itertools.rst +++ b/Doc/library/itertools.rst @@ -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:`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:`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:`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:`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:`starmap` func, seq func(\*seq[0]), func(\*seq[1]), ... ``starmap(pow, [(2,5), (3,2), (10,3)]) --> 32 9 1000`` diff --git a/Doc/library/os.path.rst b/Doc/library/os.path.rst index 0deb0fb26a3b..3cc60cbbf9b9 100644 --- a/Doc/library/os.path.rst +++ b/Doc/library/os.path.rst @@ -127,7 +127,7 @@ the :mod:`glob` module.) .. versionadded:: 1.5.2 .. 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. @@ -140,7 +140,7 @@ the :mod:`glob` module.) .. versionadded:: 1.5.2 .. 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. @@ -345,7 +345,7 @@ the :mod:`glob` module.) .. 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). .. versionadded:: 2.3 diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index 6ca50d8a5534..d52cbb0b246f 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -234,10 +234,10 @@ Module functions and constants .. function:: enable_callback_tracebacks(flag) By default you will not get any tracebacks in user-defined functions, - aggregates, converters, authorizer callbacks etc. If you want to debug them, you - can call this function with *flag* as True. Afterwards, you will get tracebacks - from callbacks on ``sys.stderr``. Use :const:`False` to disable the feature - again. + aggregates, converters, authorizer callbacks etc. If you want to debug them, + you can call this function with *flag* set to ``True``. Afterwards, you will + get tracebacks from callbacks on ``sys.stderr``. Use :const:`False` to + disable the feature again. .. _sqlite3-connection-objects: diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst index fe653b4015ec..5b737679649f 100644 --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -166,7 +166,7 @@ Functions, Constants, and Exceptions .. 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` and :func:`ssl.RAND_add` to increase the randomness of the pseudo-random number generator. diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 1e6394bdb148..accf3824815b 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -1783,7 +1783,7 @@ The constructors for both classes work the same: .. 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. .. versionadded:: 2.6 diff --git a/Doc/library/struct.rst b/Doc/library/struct.rst index 0016fcb991dd..74e320635d85 100644 --- a/Doc/library/struct.rst +++ b/Doc/library/struct.rst @@ -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 :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 -any non-zero value will be True when unpacking. +any non-zero value will be ``True`` when unpacking. diff --git a/Doc/library/ttk.rst b/Doc/library/ttk.rst index f96111de218b..6cab3e026c74 100644 --- a/Doc/library/ttk.rst +++ b/Doc/library/ttk.rst @@ -267,8 +267,8 @@ Besides the methods described below, the :class:`ttk.Widget` class supports the .. method:: instate(statespec, callback=None, *args, **kw) - Test the widget's state. If a callback is not specified, returns True - if the widget state matches *statespec* and False otherwise. If callback + Test the widget's state. If a callback is not specified, returns ``True`` + if the widget state matches *statespec* and ``False`` otherwise. If callback is specified then it is called with *args* if widget state matches *statespec*. @@ -919,7 +919,7 @@ ttk.Treeview .. 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]) @@ -1065,7 +1065,7 @@ ttk.Treeview 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 the tree. diff --git a/Doc/library/turtle.rst b/Doc/library/turtle.rst index c9bdfea7a8df..f04a07a4dfb4 100644 --- a/Doc/library/turtle.rst +++ b/Doc/library/turtle.rst @@ -1049,8 +1049,8 @@ More drawing control Write text - the string representation of *arg* - at the current turtle 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 - text. By default, *move* is False. + font. If *move* is true, the pen is moved to the bottom-right corner of the + text. By default, *move* is ``False``. >>> turtle.write("Home = ", True, align="center") >>> turtle.write((0,0), True) @@ -1086,7 +1086,7 @@ Visibility .. 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.isvisible() diff --git a/Doc/library/urllib2.rst b/Doc/library/urllib2.rst index a35f1751c2fe..d80a1a2d6e9b 100644 --- a/Doc/library/urllib2.rst +++ b/Doc/library/urllib2.rst @@ -166,7 +166,7 @@ The following classes are provided: should be the request-host of the request for the page containing the image. *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 an image in an HTML document, and the user had no option to approve the automatic fetching of the image, this should be true. diff --git a/Doc/library/zipimport.rst b/Doc/library/zipimport.rst index 450f93a97c9e..828e9fcfcf2b 100644 --- a/Doc/library/zipimport.rst +++ b/Doc/library/zipimport.rst @@ -115,7 +115,7 @@ zipimporter Objects .. 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. diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index b57b65e7acbf..adb9d31062c9 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -207,7 +207,7 @@ Ellipsis single: True 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 behave like the values 0 and 1, respectively, in almost all contexts, the exception being that when converted to a string, the strings diff --git a/Misc/NEWS b/Misc/NEWS index c1e4e6a0b31b..970dca45d21d 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -67,6 +67,11 @@ Tests - 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? ===========================