gh-103066: Add links and `help` in site.py constants (#103777)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
David Caron 2024-09-06 03:29:28 -04:00 committed by GitHub
parent d359c7c47b
commit 67957ea77d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 2 deletions

View File

@ -82,6 +82,8 @@ A small number of constants live in the built-in namespace. They are:
:exc:`SyntaxError`), so they can be considered "true" constants. :exc:`SyntaxError`), so they can be considered "true" constants.
.. _site-consts:
Constants added by the :mod:`site` module Constants added by the :mod:`site` module
----------------------------------------- -----------------------------------------
@ -97,6 +99,13 @@ should not be used in programs.
(i.e. EOF) to exit", and when called, raise :exc:`SystemExit` with the (i.e. EOF) to exit", and when called, raise :exc:`SystemExit` with the
specified exit code. specified exit code.
.. data:: help
:noindex:
Object that when printed, prints the message "Type help() for interactive
help, or help(object) for help about object.", and when called,
acts as described :func:`elsewhere <help>`.
.. data:: copyright .. data:: copyright
credits credits

View File

@ -15,8 +15,9 @@ import can be suppressed using the interpreter's :option:`-S` option.
.. index:: triple: module; search; path .. index:: triple: module; search; path
Importing this module will append site-specific paths to the module search path Importing this module normally appends site-specific paths to the module search path
and add a few builtins, unless :option:`-S` was used. In that case, this module and adds :ref:`callables <site-consts>`, including :func:`help` to the built-in
namespace. However, Python startup option :option:`-S` blocks this and this module
can be safely imported with no automatic modifications to the module search path can be safely imported with no automatic modifications to the module search path
or additions to the builtins. To explicitly trigger the usual site-specific or additions to the builtins. To explicitly trigger the usual site-specific
additions, call the :func:`main` function. additions, call the :func:`main` function.