blob: 634656a820117b82d538a019f74abe11681db706 [file] [log] [blame]
Georg Brandl116aa622007-08-15 14:28:22 +00001
2Built-in Constants
3==================
4
5A small number of constants live in the built-in namespace. They are:
6
7
Georg Brandl96593ed2007-09-07 14:15:41 +00008.. note::
9
10 :data:`None`, :data:`False`, :data:`True` and :data:`__debug__` cannot be
11 reassigned, so they can be considered "true" constants.
12
Georg Brandl55ac8f02007-09-01 13:51:09 +000013.. XXX False, True, None are keywords too
14
Georg Brandl116aa622007-08-15 14:28:22 +000015.. data:: False
16
17 The false value of the :class:`bool` type.
18
Georg Brandl116aa622007-08-15 14:28:22 +000019
20.. data:: True
21
22 The true value of the :class:`bool` type.
23
Georg Brandl116aa622007-08-15 14:28:22 +000024
25.. data:: None
26
27 The sole value of :attr:`types.NoneType`. ``None`` is frequently used to
28 represent the absence of a value, as when default arguments are not passed to a
29 function.
30
31
32.. data:: NotImplemented
33
34 Special value which can be returned by the "rich comparison" special methods
35 (:meth:`__eq__`, :meth:`__lt__`, and friends), to indicate that the comparison
36 is not implemented with respect to the other type.
37
38
39.. data:: Ellipsis
40
41 The same as ``...``. Special value used mostly in conjunction with extended
Georg Brandlcb8ecb12007-09-04 06:35:14 +000042 slicing syntax for user-defined container data types, as in ::
Georg Brandl116aa622007-08-15 14:28:22 +000043
Georg Brandlcb8ecb12007-09-04 06:35:14 +000044 val = container[1:5, 7:10, ...]
Georg Brandl96593ed2007-09-07 14:15:41 +000045
46
47.. data:: __debug__
48
49 A boolean value that is :data:`True` if Python was not started with the
50 ``-O`` command line option. Its value is used indirectly by the
51 :keyword:`assert` statement, but it can also be used directly in code.