273 lines
18 KiB
HTML
273 lines
18 KiB
HTML
|
|
|||
|
<!DOCTYPE html>
|
|||
|
|
|||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|||
|
<head>
|
|||
|
<meta charset="utf-8" />
|
|||
|
<title>Python Runtime Services — Python 3.7.4 documentation</title>
|
|||
|
<link rel="stylesheet" href="../_static/pydoctheme.css" type="text/css" />
|
|||
|
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
|||
|
|
|||
|
<script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
|
|||
|
<script type="text/javascript" src="../_static/jquery.js"></script>
|
|||
|
<script type="text/javascript" src="../_static/underscore.js"></script>
|
|||
|
<script type="text/javascript" src="../_static/doctools.js"></script>
|
|||
|
<script type="text/javascript" src="../_static/language_data.js"></script>
|
|||
|
|
|||
|
<script type="text/javascript" src="../_static/sidebar.js"></script>
|
|||
|
|
|||
|
<link rel="search" type="application/opensearchdescription+xml"
|
|||
|
title="Search within Python 3.7.4 documentation"
|
|||
|
href="../_static/opensearch.xml"/>
|
|||
|
<link rel="author" title="About these documents" href="../about.html" />
|
|||
|
<link rel="index" title="Index" href="../genindex.html" />
|
|||
|
<link rel="search" title="Search" href="../search.html" />
|
|||
|
<link rel="copyright" title="Copyright" href="../copyright.html" />
|
|||
|
<link rel="next" title="sys — System-specific parameters and functions" href="sys.html" />
|
|||
|
<link rel="prev" title="zipapp — Manage executable Python zip archives" href="zipapp.html" />
|
|||
|
<link rel="shortcut icon" type="image/png" href="../_static/py.png" />
|
|||
|
<link rel="canonical" href="https://docs.python.org/3/library/python.html" />
|
|||
|
|
|||
|
<script type="text/javascript" src="../_static/copybutton.js"></script>
|
|||
|
<script type="text/javascript" src="../_static/switchers.js"></script>
|
|||
|
|
|||
|
|
|||
|
|
|||
|
<style>
|
|||
|
@media only screen {
|
|||
|
table.full-width-table {
|
|||
|
width: 100%;
|
|||
|
}
|
|||
|
}
|
|||
|
</style>
|
|||
|
|
|||
|
|
|||
|
</head><body>
|
|||
|
|
|||
|
<div class="related" role="navigation" aria-label="related navigation">
|
|||
|
<h3>Navigation</h3>
|
|||
|
<ul>
|
|||
|
<li class="right" style="margin-right: 10px">
|
|||
|
<a href="../genindex.html" title="General Index"
|
|||
|
accesskey="I">index</a></li>
|
|||
|
<li class="right" >
|
|||
|
<a href="../py-modindex.html" title="Python Module Index"
|
|||
|
>modules</a> |</li>
|
|||
|
<li class="right" >
|
|||
|
<a href="sys.html" title="sys — System-specific parameters and functions"
|
|||
|
accesskey="N">next</a> |</li>
|
|||
|
<li class="right" >
|
|||
|
<a href="zipapp.html" title="zipapp — Manage executable Python zip archives"
|
|||
|
accesskey="P">previous</a> |</li>
|
|||
|
<li><img src="../_static/py.png" alt=""
|
|||
|
style="vertical-align: middle; margin-top: -1px"/></li>
|
|||
|
<li><a href="https://www.python.org/">Python</a> »</li>
|
|||
|
<li>
|
|||
|
<span class="language_switcher_placeholder">en</span>
|
|||
|
<span class="version_switcher_placeholder">3.7.4</span>
|
|||
|
<a href="../index.html">Documentation </a> »
|
|||
|
</li>
|
|||
|
|
|||
|
<li class="nav-item nav-item-1"><a href="index.html" accesskey="U">The Python Standard Library</a> »</li>
|
|||
|
<li class="right">
|
|||
|
|
|||
|
|
|||
|
<div class="inline-search" style="display: none" role="search">
|
|||
|
<form class="inline-search" action="../search.html" method="get">
|
|||
|
<input placeholder="Quick search" type="text" name="q" />
|
|||
|
<input type="submit" value="Go" />
|
|||
|
<input type="hidden" name="check_keywords" value="yes" />
|
|||
|
<input type="hidden" name="area" value="default" />
|
|||
|
</form>
|
|||
|
</div>
|
|||
|
<script type="text/javascript">$('.inline-search').show(0);</script>
|
|||
|
|
|
|||
|
</li>
|
|||
|
|
|||
|
</ul>
|
|||
|
</div>
|
|||
|
|
|||
|
<div class="document">
|
|||
|
<div class="documentwrapper">
|
|||
|
<div class="bodywrapper">
|
|||
|
<div class="body" role="main">
|
|||
|
|
|||
|
<div class="section" id="python-runtime-services">
|
|||
|
<span id="python"></span><h1>Python Runtime Services<a class="headerlink" href="#python-runtime-services" title="Permalink to this headline">¶</a></h1>
|
|||
|
<p>The modules described in this chapter provide a wide range of services related
|
|||
|
to the Python interpreter and its interaction with its environment. Here’s an
|
|||
|
overview:</p>
|
|||
|
<div class="toctree-wrapper compound">
|
|||
|
<ul>
|
|||
|
<li class="toctree-l1"><a class="reference internal" href="sys.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">sys</span></code> — System-specific parameters and functions</a></li>
|
|||
|
<li class="toctree-l1"><a class="reference internal" href="sysconfig.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">sysconfig</span></code> — Provide access to Python’s configuration information</a><ul>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="sysconfig.html#configuration-variables">Configuration variables</a></li>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="sysconfig.html#installation-paths">Installation paths</a></li>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="sysconfig.html#other-functions">Other functions</a></li>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="sysconfig.html#using-sysconfig-as-a-script">Using <code class="xref py py-mod docutils literal notranslate"><span class="pre">sysconfig</span></code> as a script</a></li>
|
|||
|
</ul>
|
|||
|
</li>
|
|||
|
<li class="toctree-l1"><a class="reference internal" href="builtins.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">builtins</span></code> — Built-in objects</a></li>
|
|||
|
<li class="toctree-l1"><a class="reference internal" href="__main__.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">__main__</span></code> — Top-level script environment</a></li>
|
|||
|
<li class="toctree-l1"><a class="reference internal" href="warnings.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">warnings</span></code> — Warning control</a><ul>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="warnings.html#warning-categories">Warning Categories</a></li>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="warnings.html#the-warnings-filter">The Warnings Filter</a><ul>
|
|||
|
<li class="toctree-l3"><a class="reference internal" href="warnings.html#describing-warning-filters">Describing Warning Filters</a></li>
|
|||
|
<li class="toctree-l3"><a class="reference internal" href="warnings.html#default-warning-filter">Default Warning Filter</a></li>
|
|||
|
<li class="toctree-l3"><a class="reference internal" href="warnings.html#overriding-the-default-filter">Overriding the default filter</a></li>
|
|||
|
</ul>
|
|||
|
</li>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="warnings.html#temporarily-suppressing-warnings">Temporarily Suppressing Warnings</a></li>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="warnings.html#testing-warnings">Testing Warnings</a></li>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="warnings.html#updating-code-for-new-versions-of-dependencies">Updating Code For New Versions of Dependencies</a></li>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="warnings.html#available-functions">Available Functions</a></li>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="warnings.html#available-context-managers">Available Context Managers</a></li>
|
|||
|
</ul>
|
|||
|
</li>
|
|||
|
<li class="toctree-l1"><a class="reference internal" href="dataclasses.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">dataclasses</span></code> — Data Classes</a><ul>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="dataclasses.html#module-level-decorators-classes-and-functions">Module-level decorators, classes, and functions</a></li>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="dataclasses.html#post-init-processing">Post-init processing</a></li>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="dataclasses.html#class-variables">Class variables</a></li>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="dataclasses.html#init-only-variables">Init-only variables</a></li>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="dataclasses.html#frozen-instances">Frozen instances</a></li>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="dataclasses.html#inheritance">Inheritance</a></li>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="dataclasses.html#default-factory-functions">Default factory functions</a></li>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="dataclasses.html#mutable-default-values">Mutable default values</a></li>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="dataclasses.html#exceptions">Exceptions</a></li>
|
|||
|
</ul>
|
|||
|
</li>
|
|||
|
<li class="toctree-l1"><a class="reference internal" href="contextlib.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">contextlib</span></code> — Utilities for <code class="xref std std-keyword docutils literal notranslate"><span class="pre">with</span></code>-statement contexts</a><ul>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="contextlib.html#utilities">Utilities</a></li>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="contextlib.html#examples-and-recipes">Examples and Recipes</a><ul>
|
|||
|
<li class="toctree-l3"><a class="reference internal" href="contextlib.html#supporting-a-variable-number-of-context-managers">Supporting a variable number of context managers</a></li>
|
|||
|
<li class="toctree-l3"><a class="reference internal" href="contextlib.html#catching-exceptions-from-enter-methods">Catching exceptions from <code class="docutils literal notranslate"><span class="pre">__enter__</span></code> methods</a></li>
|
|||
|
<li class="toctree-l3"><a class="reference internal" href="contextlib.html#cleaning-up-in-an-enter-implementation">Cleaning up in an <code class="docutils literal notranslate"><span class="pre">__enter__</span></code> implementation</a></li>
|
|||
|
<li class="toctree-l3"><a class="reference internal" href="contextlib.html#replacing-any-use-of-try-finally-and-flag-variables">Replacing any use of <code class="docutils literal notranslate"><span class="pre">try-finally</span></code> and flag variables</a></li>
|
|||
|
<li class="toctree-l3"><a class="reference internal" href="contextlib.html#using-a-context-manager-as-a-function-decorator">Using a context manager as a function decorator</a></li>
|
|||
|
</ul>
|
|||
|
</li>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="contextlib.html#single-use-reusable-and-reentrant-context-managers">Single use, reusable and reentrant context managers</a><ul>
|
|||
|
<li class="toctree-l3"><a class="reference internal" href="contextlib.html#reentrant-context-managers">Reentrant context managers</a></li>
|
|||
|
<li class="toctree-l3"><a class="reference internal" href="contextlib.html#reusable-context-managers">Reusable context managers</a></li>
|
|||
|
</ul>
|
|||
|
</li>
|
|||
|
</ul>
|
|||
|
</li>
|
|||
|
<li class="toctree-l1"><a class="reference internal" href="abc.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">abc</span></code> — Abstract Base Classes</a></li>
|
|||
|
<li class="toctree-l1"><a class="reference internal" href="atexit.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">atexit</span></code> — Exit handlers</a><ul>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="atexit.html#atexit-example"><code class="xref py py-mod docutils literal notranslate"><span class="pre">atexit</span></code> Example</a></li>
|
|||
|
</ul>
|
|||
|
</li>
|
|||
|
<li class="toctree-l1"><a class="reference internal" href="traceback.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">traceback</span></code> — Print or retrieve a stack traceback</a><ul>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="traceback.html#tracebackexception-objects"><code class="xref py py-class docutils literal notranslate"><span class="pre">TracebackException</span></code> Objects</a></li>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="traceback.html#stacksummary-objects"><code class="xref py py-class docutils literal notranslate"><span class="pre">StackSummary</span></code> Objects</a></li>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="traceback.html#framesummary-objects"><code class="xref py py-class docutils literal notranslate"><span class="pre">FrameSummary</span></code> Objects</a></li>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="traceback.html#traceback-examples">Traceback Examples</a></li>
|
|||
|
</ul>
|
|||
|
</li>
|
|||
|
<li class="toctree-l1"><a class="reference internal" href="__future__.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">__future__</span></code> — Future statement definitions</a></li>
|
|||
|
<li class="toctree-l1"><a class="reference internal" href="gc.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">gc</span></code> — Garbage Collector interface</a></li>
|
|||
|
<li class="toctree-l1"><a class="reference internal" href="inspect.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">inspect</span></code> — Inspect live objects</a><ul>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="inspect.html#types-and-members">Types and members</a></li>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="inspect.html#retrieving-source-code">Retrieving source code</a></li>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="inspect.html#introspecting-callables-with-the-signature-object">Introspecting callables with the Signature object</a></li>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="inspect.html#classes-and-functions">Classes and functions</a></li>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="inspect.html#the-interpreter-stack">The interpreter stack</a></li>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="inspect.html#fetching-attributes-statically">Fetching attributes statically</a></li>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="inspect.html#current-state-of-generators-and-coroutines">Current State of Generators and Coroutines</a></li>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="inspect.html#code-objects-bit-flags">Code Objects Bit Flags</a></li>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="inspect.html#command-line-interface">Command Line Interface</a></li>
|
|||
|
</ul>
|
|||
|
</li>
|
|||
|
<li class="toctree-l1"><a class="reference internal" href="site.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">site</span></code> — Site-specific configuration hook</a><ul>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="site.html#readline-configuration">Readline configuration</a></li>
|
|||
|
<li class="toctree-l2"><a class="reference internal" href="site.html#module-contents">Module contents</a></li>
|
|||
|
</ul>
|
|||
|
</li>
|
|||
|
</ul>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
|
|||
|
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
|||
|
<div class="sphinxsidebarwrapper">
|
|||
|
<h4>Previous topic</h4>
|
|||
|
<p class="topless"><a href="zipapp.html"
|
|||
|
title="previous chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">zipapp</span></code> — Manage executable Python zip archives</a></p>
|
|||
|
<h4>Next topic</h4>
|
|||
|
<p class="topless"><a href="sys.html"
|
|||
|
title="next chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">sys</span></code> — System-specific parameters and functions</a></p>
|
|||
|
<div role="note" aria-label="source link">
|
|||
|
<h3>This Page</h3>
|
|||
|
<ul class="this-page-menu">
|
|||
|
<li><a href="../bugs.html">Report a Bug</a></li>
|
|||
|
<li>
|
|||
|
<a href="https://github.com/python/cpython/blob/3.7/Doc/library/python.rst"
|
|||
|
rel="nofollow">Show Source
|
|||
|
</a>
|
|||
|
</li>
|
|||
|
</ul>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<div class="clearer"></div>
|
|||
|
</div>
|
|||
|
<div class="related" role="navigation" aria-label="related navigation">
|
|||
|
<h3>Navigation</h3>
|
|||
|
<ul>
|
|||
|
<li class="right" style="margin-right: 10px">
|
|||
|
<a href="../genindex.html" title="General Index"
|
|||
|
>index</a></li>
|
|||
|
<li class="right" >
|
|||
|
<a href="../py-modindex.html" title="Python Module Index"
|
|||
|
>modules</a> |</li>
|
|||
|
<li class="right" >
|
|||
|
<a href="sys.html" title="sys — System-specific parameters and functions"
|
|||
|
>next</a> |</li>
|
|||
|
<li class="right" >
|
|||
|
<a href="zipapp.html" title="zipapp — Manage executable Python zip archives"
|
|||
|
>previous</a> |</li>
|
|||
|
<li><img src="../_static/py.png" alt=""
|
|||
|
style="vertical-align: middle; margin-top: -1px"/></li>
|
|||
|
<li><a href="https://www.python.org/">Python</a> »</li>
|
|||
|
<li>
|
|||
|
<span class="language_switcher_placeholder">en</span>
|
|||
|
<span class="version_switcher_placeholder">3.7.4</span>
|
|||
|
<a href="../index.html">Documentation </a> »
|
|||
|
</li>
|
|||
|
|
|||
|
<li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> »</li>
|
|||
|
<li class="right">
|
|||
|
|
|||
|
|
|||
|
<div class="inline-search" style="display: none" role="search">
|
|||
|
<form class="inline-search" action="../search.html" method="get">
|
|||
|
<input placeholder="Quick search" type="text" name="q" />
|
|||
|
<input type="submit" value="Go" />
|
|||
|
<input type="hidden" name="check_keywords" value="yes" />
|
|||
|
<input type="hidden" name="area" value="default" />
|
|||
|
</form>
|
|||
|
</div>
|
|||
|
<script type="text/javascript">$('.inline-search').show(0);</script>
|
|||
|
|
|
|||
|
</li>
|
|||
|
|
|||
|
</ul>
|
|||
|
</div>
|
|||
|
<div class="footer">
|
|||
|
© <a href="../copyright.html">Copyright</a> 2001-2019, Python Software Foundation.
|
|||
|
<br />
|
|||
|
The Python Software Foundation is a non-profit corporation.
|
|||
|
<a href="https://www.python.org/psf/donations/">Please donate.</a>
|
|||
|
<br />
|
|||
|
Last updated on Jul 13, 2019.
|
|||
|
<a href="../bugs.html">Found a bug</a>?
|
|||
|
<br />
|
|||
|
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 2.0.1.
|
|||
|
</div>
|
|||
|
|
|||
|
</body>
|
|||
|
</html>
|