Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Doc/library/constants.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ A small number of constants live in the built-in namespace. They are:
``Ellipsis`` is the sole instance of the :data:`types.EllipsisType` type.


.. data:: TYPE_CHECKING

This constant is same to :data:`typing.TYPE_CHECKING`.
It is always ``False`` at runtime, but third party static type checkers
assumes it to be ``True``.

.. versionadded:: next


.. data:: __debug__

This constant is true if Python was not started with an :option:`-O` option.
Expand Down
1 change: 1 addition & 0 deletions Python/bltinmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -3407,6 +3407,7 @@ _PyBuiltin_Init(PyInterpreterState *interp)
SETBUILTIN("tuple", &PyTuple_Type);
SETBUILTIN("type", &PyType_Type);
SETBUILTIN("zip", &PyZip_Type);
SETBUILTIN("TYPE_CHECKING", Py_False);
debug = PyBool_FromLong(config->optimization_level == 0);
if (PyDict_SetItemString(dict, "__debug__", debug) < 0) {
Py_DECREF(debug);
Expand Down
Loading