Server : Apache System : Linux server1.cgrithy.com 3.10.0-1160.95.1.el7.x86_64 #1 SMP Mon Jul 24 13:59:37 UTC 2023 x86_64 User : nobody ( 99) PHP Version : 8.1.23 Disable Function : NONE Directory : /usr/share/doc/python-docs-2.7.5/html/library/ |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>4. Built-in Constants — Python 2.7.5 documentation</title> <link rel="stylesheet" href="../_static/default.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../', VERSION: '2.7.5', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </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/sidebar.js"></script> <link rel="search" type="application/opensearchdescription+xml" title="Search within Python 2.7.5 documentation" href="../_static/opensearch.xml"/> <link rel="author" title="About these documents" href="../about.html" /> <link rel="copyright" title="Copyright" href="../copyright.html" /> <link rel="top" title="Python 2.7.5 documentation" href="../index.html" /> <link rel="up" title="The Python Standard Library" href="index.html" /> <link rel="next" title="5. Built-in Types" href="stdtypes.html" /> <link rel="prev" title="2. Built-in Functions" href="functions.html" /> <link rel="shortcut icon" type="image/png" href="../_static/py.png" /> <script type="text/javascript" src="../_static/copybutton.js"></script> </head> <body> <div class="related"> <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="stdtypes.html" title="5. Built-in Types" accesskey="N">next</a> |</li> <li class="right" > <a href="functions.html" title="2. Built-in Functions" accesskey="P">previous</a> |</li> <li><img src="../_static/py.png" alt="" style="vertical-align: middle; margin-top: -1px"/></li> <li><a href="http://www.python.org/">Python</a> »</li> <li> <a href="../index.html">Python 2.7.5 documentation</a> » </li> <li><a href="index.html" accesskey="U">The Python Standard Library</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="built-in-constants"> <span id="built-in-consts"></span><h1>4. Built-in Constants<a class="headerlink" href="#built-in-constants" title="Permalink to this headline">¶</a></h1> <p>A small number of constants live in the built-in namespace. They are:</p> <dl class="data"> <dt id="False"> <tt class="descname">False</tt><a class="headerlink" href="#False" title="Permalink to this definition">¶</a></dt> <dd><p>The false value of the <a class="reference internal" href="functions.html#bool" title="bool"><tt class="xref py py-class docutils literal"><span class="pre">bool</span></tt></a> type.</p> <p class="versionadded"> <span class="versionmodified">New in version 2.3.</span></p> </dd></dl> <dl class="data"> <dt id="True"> <tt class="descname">True</tt><a class="headerlink" href="#True" title="Permalink to this definition">¶</a></dt> <dd><p>The true value of the <a class="reference internal" href="functions.html#bool" title="bool"><tt class="xref py py-class docutils literal"><span class="pre">bool</span></tt></a> type.</p> <p class="versionadded"> <span class="versionmodified">New in version 2.3.</span></p> </dd></dl> <dl class="data"> <dt id="None"> <tt class="descname">None</tt><a class="headerlink" href="#None" title="Permalink to this definition">¶</a></dt> <dd><p>The sole value of <a class="reference internal" href="types.html#types.NoneType" title="types.NoneType"><tt class="xref py py-attr docutils literal"><span class="pre">types.NoneType</span></tt></a>. <tt class="docutils literal"><span class="pre">None</span></tt> is frequently used to represent the absence of a value, as when default arguments are not passed to a function.</p> <p class="versionchanged"> <span class="versionmodified">Changed in version 2.4: </span>Assignments to <tt class="docutils literal"><span class="pre">None</span></tt> are illegal and raise a <a class="reference internal" href="exceptions.html#exceptions.SyntaxError" title="exceptions.SyntaxError"><tt class="xref py py-exc docutils literal"><span class="pre">SyntaxError</span></tt></a>.</p> </dd></dl> <dl class="data"> <dt id="NotImplemented"> <tt class="descname">NotImplemented</tt><a class="headerlink" href="#NotImplemented" title="Permalink to this definition">¶</a></dt> <dd><p>Special value which can be returned by the “rich comparison” special methods (<a class="reference internal" href="../reference/datamodel.html#object.__eq__" title="object.__eq__"><tt class="xref py py-meth docutils literal"><span class="pre">__eq__()</span></tt></a>, <a class="reference internal" href="../reference/datamodel.html#object.__lt__" title="object.__lt__"><tt class="xref py py-meth docutils literal"><span class="pre">__lt__()</span></tt></a>, and friends), to indicate that the comparison is not implemented with respect to the other type.</p> </dd></dl> <dl class="data"> <dt id="Ellipsis"> <tt class="descname">Ellipsis</tt><a class="headerlink" href="#Ellipsis" title="Permalink to this definition">¶</a></dt> <dd><p>Special value used in conjunction with extended slicing syntax.</p> </dd></dl> <dl class="data"> <dt id="__debug__"> <tt class="descname">__debug__</tt><a class="headerlink" href="#__debug__" title="Permalink to this definition">¶</a></dt> <dd><p>This constant is true if Python was not started with an <a class="reference internal" href="../using/cmdline.html#cmdoption-O"><em class="xref std std-option">-O</em></a> option. See also the <a class="reference internal" href="../reference/simple_stmts.html#assert"><tt class="xref std std-keyword docutils literal"><span class="pre">assert</span></tt></a> statement.</p> </dd></dl> <div class="admonition note"> <p class="first admonition-title">Note</p> <p>The names <a class="reference internal" href="#None" title="None"><tt class="xref py py-data docutils literal"><span class="pre">None</span></tt></a> and <a class="reference internal" href="#__debug__" title="__debug__"><tt class="xref py py-data docutils literal"><span class="pre">__debug__</span></tt></a> cannot be reassigned (assignments to them, even as an attribute name, raise <a class="reference internal" href="exceptions.html#exceptions.SyntaxError" title="exceptions.SyntaxError"><tt class="xref py py-exc docutils literal"><span class="pre">SyntaxError</span></tt></a>), so they can be considered “true” constants.</p> <p class="last versionchanged"> <span class="versionmodified">Changed in version 2.7: </span>Assignments to <tt class="docutils literal"><span class="pre">__debug__</span></tt> as an attribute became illegal.</p> </div> <div class="section" id="constants-added-by-the-site-module"> <h2>4.1. Constants added by the <a class="reference internal" href="site.html#module-site" title="site: Module responsible for site-specific configuration."><tt class="xref py py-mod docutils literal"><span class="pre">site</span></tt></a> module<a class="headerlink" href="#constants-added-by-the-site-module" title="Permalink to this headline">¶</a></h2> <p>The <a class="reference internal" href="site.html#module-site" title="site: Module responsible for site-specific configuration."><tt class="xref py py-mod docutils literal"><span class="pre">site</span></tt></a> module (which is imported automatically during startup, except if the <a class="reference internal" href="../using/cmdline.html#cmdoption-S"><em class="xref std std-option">-S</em></a> command-line option is given) adds several constants to the built-in namespace. They are useful for the interactive interpreter shell and should not be used in programs.</p> <dl class="data"> <dt id="quit"> <tt class="descname">quit</tt><big>(</big><span class="optional">[</span><em>code=None</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#quit" title="Permalink to this definition">¶</a></dt> <dt id="exit"> <tt class="descname">exit</tt><big>(</big><span class="optional">[</span><em>code=None</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#exit" title="Permalink to this definition">¶</a></dt> <dd><p>Objects that when printed, print a message like “Use quit() or Ctrl-D (i.e. EOF) to exit”, and when called, raise <a class="reference internal" href="exceptions.html#exceptions.SystemExit" title="exceptions.SystemExit"><tt class="xref py py-exc docutils literal"><span class="pre">SystemExit</span></tt></a> with the specified exit code.</p> </dd></dl> <dl class="data"> <dt id="copyright"> <tt class="descname">copyright</tt><a class="headerlink" href="#copyright" title="Permalink to this definition">¶</a></dt> <dt id="license"> <tt class="descname">license</tt><a class="headerlink" href="#license" title="Permalink to this definition">¶</a></dt> <dt id="credits"> <tt class="descname">credits</tt><a class="headerlink" href="#credits" title="Permalink to this definition">¶</a></dt> <dd><p>Objects that when printed, print a message like “Type license() to see the full license text”, and when called, display the corresponding text in a pager-like fashion (one screen at a time).</p> </dd></dl> </div> </div> </div> </div> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <h3><a href="../contents.html">Table Of Contents</a></h3> <ul> <li><a class="reference internal" href="#">4. Built-in Constants</a><ul> <li><a class="reference internal" href="#constants-added-by-the-site-module">4.1. Constants added by the <tt class="docutils literal"><span class="pre">site</span></tt> module</a></li> </ul> </li> </ul> <h4>Previous topic</h4> <p class="topless"><a href="functions.html" title="previous chapter">2. Built-in Functions</a></p> <h4>Next topic</h4> <p class="topless"><a href="stdtypes.html" title="next chapter">5. Built-in Types</a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../bugs.html">Report a Bug</a></li> <li><a href="../_sources/library/constants.txt" rel="nofollow">Show Source</a></li> </ul> <div id="searchbox" style="display: none"> <h3>Quick search</h3> <form class="search" action="../search.html" method="get"> <input 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> <p class="searchtip" style="font-size: 90%"> Enter search terms or a module, class or function name. </p> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related"> <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="stdtypes.html" title="5. Built-in Types" >next</a> |</li> <li class="right" > <a href="functions.html" title="2. Built-in Functions" >previous</a> |</li> <li><img src="../_static/py.png" alt="" style="vertical-align: middle; margin-top: -1px"/></li> <li><a href="http://www.python.org/">Python</a> »</li> <li> <a href="../index.html">Python 2.7.5 documentation</a> » </li> <li><a href="index.html" >The Python Standard Library</a> »</li> </ul> </div> <div class="footer"> © <a href="../copyright.html">Copyright</a> 1990-2020, Python Software Foundation. <br /> The Python Software Foundation is a non-profit corporation. <a href="http://www.python.org/psf/donations/">Please donate.</a> <br /> Last updated on Oct 13, 2020. <a href="../bugs.html">Found a bug</a>? <br /> Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3. </div> </body> </html>