80e792c9521d7fda0233ca14ff63b57509ce9745
[profile/ivi/python.git] / Doc / library / constants.rst
1 Built-in Constants
2 ==================
3
4 A small number of constants live in the built-in namespace.  They are:
5
6 .. data:: False
7
8    The false value of the :class:`bool` type.
9
10    .. versionadded:: 2.3
11
12
13 .. data:: True
14
15    The true value of the :class:`bool` type.
16
17    .. versionadded:: 2.3
18
19
20 .. data:: None
21
22    The sole value of :attr:`types.NoneType`.  ``None`` is frequently used to
23    represent the absence of a value, as when default arguments are not passed to a
24    function.
25
26    .. versionchanged:: 2.4
27       Assignments to ``None`` are illegal and raise a :exc:`SyntaxError`.
28
29
30 .. data:: NotImplemented
31
32    Special value which can be returned by the "rich comparison" special methods
33    (:meth:`__eq__`, :meth:`__lt__`, and friends), to indicate that the comparison
34    is not implemented with respect to the other type.
35
36
37 .. data:: Ellipsis
38
39    Special value used in conjunction with extended slicing syntax.
40
41
42 .. data:: __debug__
43
44    This constant is true if Python was not started with an :option:`-O` option.
45    See also the :keyword:`assert` statement.
46
47
48 .. note::
49
50    The names :data:`None` and :data:`__debug__` cannot be reassigned
51    (assignments to them, even as an attribute name, raise :exc:`SyntaxError`),
52    so they can be considered "true" constants.
53
54    .. versionchanged:: 2.7
55       Assignments to ``__debug__`` as an attribute became illegal.
56
57
58 Constants added by the :mod:`site` module
59 -----------------------------------------
60
61 The :mod:`site` module (which is imported automatically during startup, except
62 if the :option:`-S` command-line option is given) adds several constants to the
63 built-in namespace.  They are useful for the interactive interpreter shell and
64 should not be used in programs.
65
66 .. data:: quit([code=None])
67           exit([code=None])
68
69    Objects that when printed, print a message like "Use quit() or Ctrl-D
70    (i.e. EOF) to exit", and when called, raise :exc:`SystemExit` with the
71    specified exit code.
72
73 .. data:: copyright
74           license
75           credits
76
77    Objects that when printed, print a message like "Type license() to see the
78    full license text", and when called, display the corresponding text in a
79    pager-like fashion (one screen at a time).