Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 1 | |
| 2 | Built-in Constants |
| 3 | ================== |
| 4 | |
| 5 | A small number of constants live in the built-in namespace. They are: |
| 6 | |
| 7 | |
| 8 | .. data:: False |
| 9 | |
| 10 | The false value of the :class:`bool` type. |
| 11 | |
| 12 | .. versionadded:: 2.3 |
| 13 | |
| 14 | |
| 15 | .. data:: True |
| 16 | |
| 17 | The true value of the :class:`bool` type. |
| 18 | |
| 19 | .. versionadded:: 2.3 |
| 20 | |
| 21 | |
| 22 | .. data:: None |
| 23 | |
| 24 | The sole value of :attr:`types.NoneType`. ``None`` is frequently used to |
| 25 | represent the absence of a value, as when default arguments are not passed to a |
| 26 | function. |
| 27 | |
Georg Brandl | b19be57 | 2007-12-29 10:57:00 +0000 | [diff] [blame] | 28 | .. versionchanged:: 2.4 |
| 29 | Assignments to ``None`` are illegal and raise a :exc:`SyntaxError`. |
| 30 | |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 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 | Special value used in conjunction with extended slicing syntax. |
| 42 | |
Georg Brandl | b19be57 | 2007-12-29 10:57:00 +0000 | [diff] [blame] | 43 | .. XXX Someone who understands extended slicing should fill in here. |
Georg Brandl | 8ec7f65 | 2007-08-15 14:28:01 +0000 | [diff] [blame] | 44 | |
Georg Brandl | b19be57 | 2007-12-29 10:57:00 +0000 | [diff] [blame] | 45 | |
| 46 | .. data:: __debug__ |
| 47 | |
| 48 | This constant is true if Python was not started with an :option:`-O` option. |
| 49 | Assignments to :const:`__debug__` are illegal and raise a :exc:`SyntaxError`. |
| 50 | See also the :keyword:`assert` statement. |