~dkuhlman/python-training-materials/Materials

« back to all changes in this revision

Viewing changes to python-2.7.12-docs-html/glossary.html

  • Committer: Dave Kuhlman
  • Date: 2017-04-15 16:24:56 UTC
  • Revision ID: dkuhlman@davekuhlman.org-20170415162456-iav9vozzg4iwqwv3
Updated docs

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 
2
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
3
 
 
4
 
 
5
<html xmlns="http://www.w3.org/1999/xhtml">
 
6
  <head>
 
7
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 
8
    
 
9
    <title>Glossary &mdash; Python 2.7.12 documentation</title>
 
10
    
 
11
    <link rel="stylesheet" href="_static/classic.css" type="text/css" />
 
12
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
 
13
    
 
14
    <script type="text/javascript">
 
15
      var DOCUMENTATION_OPTIONS = {
 
16
        URL_ROOT:    './',
 
17
        VERSION:     '2.7.12',
 
18
        COLLAPSE_INDEX: false,
 
19
        FILE_SUFFIX: '.html',
 
20
        HAS_SOURCE:  true
 
21
      };
 
22
    </script>
 
23
    <script type="text/javascript" src="_static/jquery.js"></script>
 
24
    <script type="text/javascript" src="_static/underscore.js"></script>
 
25
    <script type="text/javascript" src="_static/doctools.js"></script>
 
26
    <script type="text/javascript" src="_static/sidebar.js"></script>
 
27
    <link rel="search" type="application/opensearchdescription+xml"
 
28
          title="Search within Python 2.7.12 documentation"
 
29
          href="_static/opensearch.xml"/>
 
30
    <link rel="author" title="About these documents" href="about.html" />
 
31
    <link rel="copyright" title="Copyright" href="copyright.html" />
 
32
    <link rel="top" title="Python 2.7.12 documentation" href="contents.html" />
 
33
    <link rel="next" title="About these documents" href="about.html" />
 
34
    <link rel="prev" title="“Why is Python Installed on my Computer?” FAQ" href="faq/installed.html" />
 
35
    <link rel="shortcut icon" type="image/png" href="_static/py.png" />
 
36
    <script type="text/javascript" src="_static/copybutton.js"></script>
 
37
    <script type="text/javascript" src="_static/version_switch.js"></script>
 
38
 
 
39
    
 
40
 
 
41
  </head>
 
42
  <body role="document">  
 
43
    <div class="related" role="navigation" aria-label="related navigation">
 
44
      <h3>Navigation</h3>
 
45
      <ul>
 
46
        <li class="right" style="margin-right: 10px">
 
47
          <a href="genindex.html" title="General Index"
 
48
             accesskey="I">index</a></li>
 
49
        <li class="right" >
 
50
          <a href="py-modindex.html" title="Python Module Index"
 
51
             >modules</a> |</li>
 
52
        <li class="right" >
 
53
          <a href="about.html" title="About these documents"
 
54
             accesskey="N">next</a> |</li>
 
55
        <li class="right" >
 
56
          <a href="faq/installed.html" title="“Why is Python Installed on my Computer?” FAQ"
 
57
             accesskey="P">previous</a> |</li>
 
58
        <li><img src="_static/py.png" alt=""
 
59
                 style="vertical-align: middle; margin-top: -1px"/></li>
 
60
        <li><a href="https://www.python.org/">Python</a> &raquo;</li>
 
61
        <li>
 
62
          <span class="version_switcher_placeholder">2.7.12</span>
 
63
          <a href="index.html">Documentation</a> &raquo;
 
64
        </li>
 
65
 
 
66
      </ul>
 
67
    </div>    
 
68
 
 
69
    <div class="document">
 
70
      <div class="documentwrapper">
 
71
        <div class="bodywrapper">
 
72
          <div class="body" role="main">
 
73
            
 
74
  <div class="section" id="glossary">
 
75
<span id="id1"></span><h1>Glossary<a class="headerlink" href="#glossary" title="Permalink to this headline">¶</a></h1>
 
76
<dl class="glossary docutils">
 
77
<dt id="term"><code class="docutils literal"><span class="pre">&gt;&gt;&gt;</span></code></dt>
 
78
<dd>The default Python prompt of the interactive shell.  Often seen for code
 
79
examples which can be executed interactively in the interpreter.</dd>
 
80
<dt id="term-1"><code class="docutils literal"><span class="pre">...</span></code></dt>
 
81
<dd>The default Python prompt of the interactive shell when entering code for
 
82
an indented code block or within a pair of matching left and right
 
83
delimiters (parentheses, square brackets or curly braces).</dd>
 
84
<dt id="term-2to3">2to3</dt>
 
85
<dd><p class="first">A tool that tries to convert Python 2.x code to Python 3.x code by
 
86
handling most of the incompatibilities which can be detected by parsing the
 
87
source and traversing the parse tree.</p>
 
88
<p class="last">2to3 is available in the standard library as <a class="reference internal" href="library/2to3.html#module-lib2to3" title="lib2to3: the 2to3 library"><code class="xref py py-mod docutils literal"><span class="pre">lib2to3</span></code></a>; a standalone
 
89
entry point is provided as <code class="file docutils literal"><span class="pre">Tools/scripts/2to3</span></code>.  See
 
90
<a class="reference internal" href="library/2to3.html#to3-reference"><span>2to3 - Automated Python 2 to 3 code translation</span></a>.</p>
 
91
</dd>
 
92
<dt id="term-abstract-base-class">abstract base class</dt>
 
93
<dd>Abstract base classes complement <a class="reference internal" href="#term-duck-typing"><span class="xref std std-term">duck-typing</span></a> by
 
94
providing a way to define interfaces when other techniques like
 
95
<a class="reference internal" href="library/functions.html#hasattr" title="hasattr"><code class="xref py py-func docutils literal"><span class="pre">hasattr()</span></code></a> would be clumsy or subtly wrong (for example with
 
96
<a class="reference internal" href="reference/datamodel.html#new-style-special-lookup"><span>magic methods</span></a>).  ABCs introduce virtual
 
97
subclasses, which are classes that don&#8217;t inherit from a class but are
 
98
still recognized by <a class="reference internal" href="library/functions.html#isinstance" title="isinstance"><code class="xref py py-func docutils literal"><span class="pre">isinstance()</span></code></a> and <a class="reference internal" href="library/functions.html#issubclass" title="issubclass"><code class="xref py py-func docutils literal"><span class="pre">issubclass()</span></code></a>; see the
 
99
<a class="reference internal" href="library/abc.html#module-abc" title="abc: Abstract base classes according to PEP 3119."><code class="xref py py-mod docutils literal"><span class="pre">abc</span></code></a> module documentation.  Python comes with many built-in ABCs for
 
100
data structures (in the <a class="reference internal" href="library/collections.html#module-collections" title="collections: High-performance datatypes"><code class="xref py py-mod docutils literal"><span class="pre">collections</span></code></a> module), numbers (in the
 
101
<a class="reference internal" href="library/numbers.html#module-numbers" title="numbers: Numeric abstract base classes (Complex, Real, Integral, etc.)."><code class="xref py py-mod docutils literal"><span class="pre">numbers</span></code></a> module), and streams (in the <a class="reference internal" href="library/io.html#module-io" title="io: Core tools for working with streams."><code class="xref py py-mod docutils literal"><span class="pre">io</span></code></a> module). You can
 
102
create your own ABCs with the <a class="reference internal" href="library/abc.html#module-abc" title="abc: Abstract base classes according to PEP 3119."><code class="xref py py-mod docutils literal"><span class="pre">abc</span></code></a> module.</dd>
 
103
<dt id="term-argument">argument</dt>
 
104
<dd><p class="first">A value passed to a <a class="reference internal" href="#term-function"><span class="xref std std-term">function</span></a> (or <a class="reference internal" href="#term-method"><span class="xref std std-term">method</span></a>) when calling the
 
105
function.  There are two types of arguments:</p>
 
106
<ul>
 
107
<li><p class="first"><em class="dfn">keyword argument</em>: an argument preceded by an identifier (e.g.
 
108
<code class="docutils literal"><span class="pre">name=</span></code>) in a function call or passed as a value in a dictionary
 
109
preceded by <code class="docutils literal"><span class="pre">**</span></code>.  For example, <code class="docutils literal"><span class="pre">3</span></code> and <code class="docutils literal"><span class="pre">5</span></code> are both keyword
 
110
arguments in the following calls to <a class="reference internal" href="library/functions.html#complex" title="complex"><code class="xref py py-func docutils literal"><span class="pre">complex()</span></code></a>:</p>
 
111
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="nb">complex</span><span class="p">(</span><span class="n">real</span><span class="o">=</span><span class="mi">3</span><span class="p">,</span> <span class="n">imag</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span>
 
112
<span class="nb">complex</span><span class="p">(</span><span class="o">**</span><span class="p">{</span><span class="s1">&#39;real&#39;</span><span class="p">:</span> <span class="mi">3</span><span class="p">,</span> <span class="s1">&#39;imag&#39;</span><span class="p">:</span> <span class="mi">5</span><span class="p">})</span>
 
113
</pre></div>
 
114
</div>
 
115
</li>
 
116
<li><p class="first"><em class="dfn">positional argument</em>: an argument that is not a keyword argument.
 
117
Positional arguments can appear at the beginning of an argument list
 
118
and/or be passed as elements of an <a class="reference internal" href="#term-iterable"><span class="xref std std-term">iterable</span></a> preceded by <code class="docutils literal"><span class="pre">*</span></code>.
 
119
For example, <code class="docutils literal"><span class="pre">3</span></code> and <code class="docutils literal"><span class="pre">5</span></code> are both positional arguments in the
 
120
following calls:</p>
 
121
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="nb">complex</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">5</span><span class="p">)</span>
 
122
<span class="nb">complex</span><span class="p">(</span><span class="o">*</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">5</span><span class="p">))</span>
 
123
</pre></div>
 
124
</div>
 
125
</li>
 
126
</ul>
 
127
<p>Arguments are assigned to the named local variables in a function body.
 
128
See the <a class="reference internal" href="reference/expressions.html#calls"><span>Calls</span></a> section for the rules governing this assignment.
 
129
Syntactically, any expression can be used to represent an argument; the
 
130
evaluated value is assigned to the local variable.</p>
 
131
<p class="last">See also the <a class="reference internal" href="#term-parameter"><span class="xref std std-term">parameter</span></a> glossary entry and the FAQ question on
 
132
<a class="reference internal" href="faq/programming.html#faq-argument-vs-parameter"><span>the difference between arguments and parameters</span></a>.</p>
 
133
</dd>
 
134
<dt id="term-attribute">attribute</dt>
 
135
<dd>A value associated with an object which is referenced by name using
 
136
dotted expressions.  For example, if an object <em>o</em> has an attribute
 
137
<em>a</em> it would be referenced as <em>o.a</em>.</dd>
 
138
<dt id="term-bdfl">BDFL</dt>
 
139
<dd>Benevolent Dictator For Life, a.k.a. <a class="reference external" href="https://www.python.org/~guido/">Guido van Rossum</a>, Python&#8217;s creator.</dd>
 
140
<dt id="term-bytes-like-object">bytes-like object</dt>
 
141
<dd>An object that supports the <a class="reference internal" href="c-api/buffer.html#bufferobjects"><span>buffer protocol</span></a>,
 
142
like <a class="reference internal" href="library/functions.html#str" title="str"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>, <a class="reference internal" href="library/functions.html#bytearray" title="bytearray"><code class="xref py py-class docutils literal"><span class="pre">bytearray</span></code></a> or <a class="reference internal" href="library/stdtypes.html#memoryview" title="memoryview"><code class="xref py py-class docutils literal"><span class="pre">memoryview</span></code></a>.
 
143
Bytes-like objects can be used for various operations that expect
 
144
binary data, such as compression, saving to a binary file or sending
 
145
over a socket. Some operations need the binary data to be mutable,
 
146
in which case not all bytes-like objects can apply.</dd>
 
147
<dt id="term-bytecode">bytecode</dt>
 
148
<dd><p class="first">Python source code is compiled into bytecode, the internal representation
 
149
of a Python program in the CPython interpreter.  The bytecode is also
 
150
cached in <code class="docutils literal"><span class="pre">.pyc</span></code> and <code class="docutils literal"><span class="pre">.pyo</span></code> files so that executing the same file is
 
151
faster the second time (recompilation from source to bytecode can be
 
152
avoided).  This &#8220;intermediate language&#8221; is said to run on a
 
153
<a class="reference internal" href="#term-virtual-machine"><span class="xref std std-term">virtual machine</span></a> that executes the machine code corresponding to
 
154
each bytecode. Do note that bytecodes are not expected to work between
 
155
different Python virtual machines, nor to be stable between Python
 
156
releases.</p>
 
157
<p class="last">A list of bytecode instructions can be found in the documentation for
 
158
<a class="reference internal" href="library/dis.html#bytecodes"><span>the dis module</span></a>.</p>
 
159
</dd>
 
160
<dt id="term-class">class</dt>
 
161
<dd>A template for creating user-defined objects. Class definitions
 
162
normally contain method definitions which operate on instances of the
 
163
class.</dd>
 
164
<dt id="term-classic-class">classic class</dt>
 
165
<dd>Any class which does not inherit from <a class="reference internal" href="library/functions.html#object" title="object"><code class="xref py py-class docutils literal"><span class="pre">object</span></code></a>.  See
 
166
<a class="reference internal" href="#term-new-style-class"><span class="xref std std-term">new-style class</span></a>.  Classic classes have been removed in Python 3.</dd>
 
167
<dt id="term-coercion">coercion</dt>
 
168
<dd>The implicit conversion of an instance of one type to another during an
 
169
operation which involves two arguments of the same type.  For example,
 
170
<code class="docutils literal"><span class="pre">int(3.15)</span></code> converts the floating point number to the integer <code class="docutils literal"><span class="pre">3</span></code>, but
 
171
in <code class="docutils literal"><span class="pre">3+4.5</span></code>, each argument is of a different type (one int, one float),
 
172
and both must be converted to the same type before they can be added or it
 
173
will raise a <code class="docutils literal"><span class="pre">TypeError</span></code>.  Coercion between two operands can be
 
174
performed with the <code class="docutils literal"><span class="pre">coerce</span></code> built-in function; thus, <code class="docutils literal"><span class="pre">3+4.5</span></code> is
 
175
equivalent to calling <code class="docutils literal"><span class="pre">operator.add(*coerce(3,</span> <span class="pre">4.5))</span></code> and results in
 
176
<code class="docutils literal"><span class="pre">operator.add(3.0,</span> <span class="pre">4.5)</span></code>.  Without coercion, all arguments of even
 
177
compatible types would have to be normalized to the same value by the
 
178
programmer, e.g., <code class="docutils literal"><span class="pre">float(3)+4.5</span></code> rather than just <code class="docutils literal"><span class="pre">3+4.5</span></code>.</dd>
 
179
<dt id="term-complex-number">complex number</dt>
 
180
<dd>An extension of the familiar real number system in which all numbers are
 
181
expressed as a sum of a real part and an imaginary part.  Imaginary
 
182
numbers are real multiples of the imaginary unit (the square root of
 
183
<code class="docutils literal"><span class="pre">-1</span></code>), often written <code class="docutils literal"><span class="pre">i</span></code> in mathematics or <code class="docutils literal"><span class="pre">j</span></code> in
 
184
engineering.  Python has built-in support for complex numbers, which are
 
185
written with this latter notation; the imaginary part is written with a
 
186
<code class="docutils literal"><span class="pre">j</span></code> suffix, e.g., <code class="docutils literal"><span class="pre">3+1j</span></code>.  To get access to complex equivalents of the
 
187
<a class="reference internal" href="library/math.html#module-math" title="math: Mathematical functions (sin() etc.)."><code class="xref py py-mod docutils literal"><span class="pre">math</span></code></a> module, use <a class="reference internal" href="library/cmath.html#module-cmath" title="cmath: Mathematical functions for complex numbers."><code class="xref py py-mod docutils literal"><span class="pre">cmath</span></code></a>.  Use of complex numbers is a fairly
 
188
advanced mathematical feature.  If you&#8217;re not aware of a need for them,
 
189
it&#8217;s almost certain you can safely ignore them.</dd>
 
190
<dt id="term-context-manager">context manager</dt>
 
191
<dd>An object which controls the environment seen in a <a class="reference internal" href="reference/compound_stmts.html#with"><code class="xref std std-keyword docutils literal"><span class="pre">with</span></code></a>
 
192
statement by defining <a class="reference internal" href="reference/datamodel.html#object.__enter__" title="object.__enter__"><code class="xref py py-meth docutils literal"><span class="pre">__enter__()</span></code></a> and <a class="reference internal" href="reference/datamodel.html#object.__exit__" title="object.__exit__"><code class="xref py py-meth docutils literal"><span class="pre">__exit__()</span></code></a> methods.
 
193
See <span class="target" id="index-0"></span><a class="pep reference external" href="https://www.python.org/dev/peps/pep-0343"><strong>PEP 343</strong></a>.</dd>
 
194
<dt id="term-cpython">CPython</dt>
 
195
<dd>The canonical implementation of the Python programming language, as
 
196
distributed on <a class="reference external" href="https://www.python.org">python.org</a>.  The term &#8220;CPython&#8221;
 
197
is used when necessary to distinguish this implementation from others
 
198
such as Jython or IronPython.</dd>
 
199
<dt id="term-decorator">decorator</dt>
 
200
<dd><p class="first">A function returning another function, usually applied as a function
 
201
transformation using the <code class="docutils literal"><span class="pre">&#64;wrapper</span></code> syntax.  Common examples for
 
202
decorators are <a class="reference internal" href="library/functions.html#classmethod" title="classmethod"><code class="xref py py-func docutils literal"><span class="pre">classmethod()</span></code></a> and <a class="reference internal" href="library/functions.html#staticmethod" title="staticmethod"><code class="xref py py-func docutils literal"><span class="pre">staticmethod()</span></code></a>.</p>
 
203
<p>The decorator syntax is merely syntactic sugar, the following two
 
204
function definitions are semantically equivalent:</p>
 
205
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">f</span><span class="p">(</span><span class="o">...</span><span class="p">):</span>
 
206
    <span class="o">...</span>
 
207
<span class="n">f</span> <span class="o">=</span> <span class="nb">staticmethod</span><span class="p">(</span><span class="n">f</span><span class="p">)</span>
 
208
 
 
209
<span class="nd">@staticmethod</span>
 
210
<span class="k">def</span> <span class="nf">f</span><span class="p">(</span><span class="o">...</span><span class="p">):</span>
 
211
    <span class="o">...</span>
 
212
</pre></div>
 
213
</div>
 
214
<p class="last">The same concept exists for classes, but is less commonly used there.  See
 
215
the documentation for <a class="reference internal" href="reference/compound_stmts.html#function"><span>function definitions</span></a> and
 
216
<a class="reference internal" href="reference/compound_stmts.html#class"><span>class definitions</span></a> for more about decorators.</p>
 
217
</dd>
 
218
<dt id="term-descriptor">descriptor</dt>
 
219
<dd><p class="first">Any <em>new-style</em> object which defines the methods <a class="reference internal" href="reference/datamodel.html#object.__get__" title="object.__get__"><code class="xref py py-meth docutils literal"><span class="pre">__get__()</span></code></a>,
 
220
<a class="reference internal" href="reference/datamodel.html#object.__set__" title="object.__set__"><code class="xref py py-meth docutils literal"><span class="pre">__set__()</span></code></a>, or <a class="reference internal" href="reference/datamodel.html#object.__delete__" title="object.__delete__"><code class="xref py py-meth docutils literal"><span class="pre">__delete__()</span></code></a>.  When a class attribute is a
 
221
descriptor, its special binding behavior is triggered upon attribute
 
222
lookup.  Normally, using <em>a.b</em> to get, set or delete an attribute looks up
 
223
the object named <em>b</em> in the class dictionary for <em>a</em>, but if <em>b</em> is a
 
224
descriptor, the respective descriptor method gets called.  Understanding
 
225
descriptors is a key to a deep understanding of Python because they are
 
226
the basis for many features including functions, methods, properties,
 
227
class methods, static methods, and reference to super classes.</p>
 
228
<p class="last">For more information about descriptors&#8217; methods, see <a class="reference internal" href="reference/datamodel.html#descriptors"><span>Implementing Descriptors</span></a>.</p>
 
229
</dd>
 
230
<dt id="term-dictionary">dictionary</dt>
 
231
<dd>An associative array, where arbitrary keys are mapped to values.  The
 
232
keys can be any object with <a class="reference internal" href="reference/datamodel.html#object.__hash__" title="object.__hash__"><code class="xref py py-meth docutils literal"><span class="pre">__hash__()</span></code></a>  and <a class="reference internal" href="reference/datamodel.html#object.__eq__" title="object.__eq__"><code class="xref py py-meth docutils literal"><span class="pre">__eq__()</span></code></a> methods.
 
233
Called a hash in Perl.</dd>
 
234
<dt id="term-dictionary-view">dictionary view</dt>
 
235
<dd>The objects returned from <a class="reference internal" href="library/stdtypes.html#dict.viewkeys" title="dict.viewkeys"><code class="xref py py-meth docutils literal"><span class="pre">dict.viewkeys()</span></code></a>, <a class="reference internal" href="library/stdtypes.html#dict.viewvalues" title="dict.viewvalues"><code class="xref py py-meth docutils literal"><span class="pre">dict.viewvalues()</span></code></a>,
 
236
and <a class="reference internal" href="library/stdtypes.html#dict.viewitems" title="dict.viewitems"><code class="xref py py-meth docutils literal"><span class="pre">dict.viewitems()</span></code></a> are called dictionary views. They provide a dynamic
 
237
view on the dictionary’s entries, which means that when the dictionary
 
238
changes, the view reflects these changes. To force the
 
239
dictionary view to become a full list use <code class="docutils literal"><span class="pre">list(dictview)</span></code>.  See
 
240
<a class="reference internal" href="library/stdtypes.html#dict-views"><span>Dictionary view objects</span></a>.</dd>
 
241
<dt id="term-docstring">docstring</dt>
 
242
<dd>A string literal which appears as the first expression in a class,
 
243
function or module.  While ignored when the suite is executed, it is
 
244
recognized by the compiler and put into the <code class="xref py py-attr docutils literal"><span class="pre">__doc__</span></code> attribute
 
245
of the enclosing class, function or module.  Since it is available via
 
246
introspection, it is the canonical place for documentation of the
 
247
object.</dd>
 
248
<dt id="term-duck-typing">duck-typing</dt>
 
249
<dd>A programming style which does not look at an object&#8217;s type to determine
 
250
if it has the right interface; instead, the method or attribute is simply
 
251
called or used (&#8220;If it looks like a duck and quacks like a duck, it
 
252
must be a duck.&#8221;)  By emphasizing interfaces rather than specific types,
 
253
well-designed code improves its flexibility by allowing polymorphic
 
254
substitution.  Duck-typing avoids tests using <a class="reference internal" href="library/functions.html#type" title="type"><code class="xref py py-func docutils literal"><span class="pre">type()</span></code></a> or
 
255
<a class="reference internal" href="library/functions.html#isinstance" title="isinstance"><code class="xref py py-func docutils literal"><span class="pre">isinstance()</span></code></a>.  (Note, however, that duck-typing can be complemented
 
256
with <a class="reference internal" href="#term-abstract-base-class"><span class="xref std std-term">abstract base classes</span></a>.)  Instead, it
 
257
typically employs <a class="reference internal" href="library/functions.html#hasattr" title="hasattr"><code class="xref py py-func docutils literal"><span class="pre">hasattr()</span></code></a> tests or <a class="reference internal" href="#term-eafp"><span class="xref std std-term">EAFP</span></a> programming.</dd>
 
258
<dt id="term-eafp">EAFP</dt>
 
259
<dd>Easier to ask for forgiveness than permission.  This common Python coding
 
260
style assumes the existence of valid keys or attributes and catches
 
261
exceptions if the assumption proves false.  This clean and fast style is
 
262
characterized by the presence of many <a class="reference internal" href="reference/compound_stmts.html#try"><code class="xref std std-keyword docutils literal"><span class="pre">try</span></code></a> and <a class="reference internal" href="reference/compound_stmts.html#except"><code class="xref std std-keyword docutils literal"><span class="pre">except</span></code></a>
 
263
statements.  The technique contrasts with the <a class="reference internal" href="#term-lbyl"><span class="xref std std-term">LBYL</span></a> style
 
264
common to many other languages such as C.</dd>
 
265
<dt id="term-expression">expression</dt>
 
266
<dd>A piece of syntax which can be evaluated to some value.  In other words,
 
267
an expression is an accumulation of expression elements like literals,
 
268
names, attribute access, operators or function calls which all return a
 
269
value.  In contrast to many other languages, not all language constructs
 
270
are expressions.  There are also <a class="reference internal" href="#term-statement"><span class="xref std std-term">statement</span></a>s which cannot be used
 
271
as expressions, such as <a class="reference internal" href="reference/simple_stmts.html#print"><code class="xref std std-keyword docutils literal"><span class="pre">print</span></code></a> or <a class="reference internal" href="reference/compound_stmts.html#if"><code class="xref std std-keyword docutils literal"><span class="pre">if</span></code></a>.  Assignments
 
272
are also statements, not expressions.</dd>
 
273
<dt id="term-extension-module">extension module</dt>
 
274
<dd>A module written in C or C++, using Python&#8217;s C API to interact with the
 
275
core and with user code.</dd>
 
276
<dt id="term-file-object">file object</dt>
 
277
<dd><p class="first">An object exposing a file-oriented API (with methods such as
 
278
<code class="xref py py-meth docutils literal"><span class="pre">read()</span></code> or <code class="xref py py-meth docutils literal"><span class="pre">write()</span></code>) to an underlying resource.  Depending
 
279
on the way it was created, a file object can mediate access to a real
 
280
on-disk file or to another type of storage or communication device
 
281
(for example standard input/output, in-memory buffers, sockets, pipes,
 
282
etc.).  File objects are also called <em class="dfn">file-like objects</em> or
 
283
<em class="dfn">streams</em>.</p>
 
284
<p class="last">There are actually three categories of file objects: raw binary files,
 
285
buffered binary files and text files.  Their interfaces are defined in the
 
286
<a class="reference internal" href="library/io.html#module-io" title="io: Core tools for working with streams."><code class="xref py py-mod docutils literal"><span class="pre">io</span></code></a> module.  The canonical way to create a file object is by using
 
287
the <a class="reference internal" href="library/functions.html#open" title="open"><code class="xref py py-func docutils literal"><span class="pre">open()</span></code></a> function.</p>
 
288
</dd>
 
289
<dt id="term-file-like-object">file-like object</dt>
 
290
<dd>A synonym for <a class="reference internal" href="#term-file-object"><span class="xref std std-term">file object</span></a>.</dd>
 
291
<dt id="term-finder">finder</dt>
 
292
<dd>An object that tries to find the <a class="reference internal" href="#term-loader"><span class="xref std std-term">loader</span></a> for a module. It must
 
293
implement a method named <code class="xref py py-meth docutils literal"><span class="pre">find_module()</span></code>. See <span class="target" id="index-1"></span><a class="pep reference external" href="https://www.python.org/dev/peps/pep-0302"><strong>PEP 302</strong></a> for
 
294
details.</dd>
 
295
<dt id="term-floor-division">floor division</dt>
 
296
<dd>Mathematical division that rounds down to nearest integer.  The floor
 
297
division operator is <code class="docutils literal"><span class="pre">//</span></code>.  For example, the expression <code class="docutils literal"><span class="pre">11</span> <span class="pre">//</span> <span class="pre">4</span></code>
 
298
evaluates to <code class="docutils literal"><span class="pre">2</span></code> in contrast to the <code class="docutils literal"><span class="pre">2.75</span></code> returned by float true
 
299
division.  Note that <code class="docutils literal"><span class="pre">(-11)</span> <span class="pre">//</span> <span class="pre">4</span></code> is <code class="docutils literal"><span class="pre">-3</span></code> because that is <code class="docutils literal"><span class="pre">-2.75</span></code>
 
300
rounded <em>downward</em>. See <span class="target" id="index-2"></span><a class="pep reference external" href="https://www.python.org/dev/peps/pep-0238"><strong>PEP 238</strong></a>.</dd>
 
301
<dt id="term-function">function</dt>
 
302
<dd>A series of statements which returns some value to a caller. It can also
 
303
be passed zero or more <a class="reference internal" href="#term-argument"><span class="xref std std-term">arguments</span></a> which may be used in
 
304
the execution of the body. See also <a class="reference internal" href="#term-parameter"><span class="xref std std-term">parameter</span></a>, <a class="reference internal" href="#term-method"><span class="xref std std-term">method</span></a>,
 
305
and the <a class="reference internal" href="reference/compound_stmts.html#function"><span>Function definitions</span></a> section.</dd>
 
306
<dt id="term-future">__future__</dt>
 
307
<dd><p class="first">A pseudo-module which programmers can use to enable new language features
 
308
which are not compatible with the current interpreter.  For example, the
 
309
expression <code class="docutils literal"><span class="pre">11/4</span></code> currently evaluates to <code class="docutils literal"><span class="pre">2</span></code>. If the module in which
 
310
it is executed had enabled <em>true division</em> by executing:</p>
 
311
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">division</span>
 
312
</pre></div>
 
313
</div>
 
314
<p>the expression <code class="docutils literal"><span class="pre">11/4</span></code> would evaluate to <code class="docutils literal"><span class="pre">2.75</span></code>.  By importing the
 
315
<a class="reference internal" href="library/__future__.html#module-__future__" title="__future__: Future statement definitions"><code class="xref py py-mod docutils literal"><span class="pre">__future__</span></code></a> module and evaluating its variables, you can see when a
 
316
new feature was first added to the language and when it will become the
 
317
default:</p>
 
318
<div class="last highlight-python"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">__future__</span>
 
319
<span class="gp">&gt;&gt;&gt; </span><span class="n">__future__</span><span class="o">.</span><span class="n">division</span>
 
320
<span class="go">_Feature((2, 2, 0, &#39;alpha&#39;, 2), (3, 0, 0, &#39;alpha&#39;, 0), 8192)</span>
 
321
</pre></div>
 
322
</div>
 
323
</dd>
 
324
<dt id="term-garbage-collection">garbage collection</dt>
 
325
<dd>The process of freeing memory when it is not used anymore.  Python
 
326
performs garbage collection via reference counting and a cyclic garbage
 
327
collector that is able to detect and break reference cycles.</dd>
 
328
<dt id="term-generator">generator</dt>
 
329
<dd>A function which returns an iterator.  It looks like a normal function
 
330
except that it contains <a class="reference internal" href="reference/simple_stmts.html#yield"><code class="xref std std-keyword docutils literal"><span class="pre">yield</span></code></a> statements for producing a series
 
331
of values usable in a for-loop or that can be retrieved one at a time with
 
332
the <a class="reference internal" href="library/functions.html#next" title="next"><code class="xref py py-func docutils literal"><span class="pre">next()</span></code></a> function. Each <a class="reference internal" href="reference/simple_stmts.html#yield"><code class="xref std std-keyword docutils literal"><span class="pre">yield</span></code></a> temporarily suspends
 
333
processing, remembering the location execution state (including local
 
334
variables and pending try-statements).  When the generator resumes, it
 
335
picks-up where it left-off (in contrast to functions which start fresh on
 
336
every invocation).</dd>
 
337
<dt id="term-generator-expression">generator expression</dt>
 
338
<dd><p class="first">An expression that returns an iterator.  It looks like a normal expression
 
339
followed by a <a class="reference internal" href="reference/compound_stmts.html#for"><code class="xref std std-keyword docutils literal"><span class="pre">for</span></code></a> expression defining a loop variable, range,
 
340
and an optional <a class="reference internal" href="reference/compound_stmts.html#if"><code class="xref std std-keyword docutils literal"><span class="pre">if</span></code></a> expression.  The combined expression
 
341
generates values for an enclosing function:</p>
 
342
<div class="last highlight-python"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="nb">sum</span><span class="p">(</span><span class="n">i</span><span class="o">*</span><span class="n">i</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">10</span><span class="p">))</span>         <span class="c1"># sum of squares 0, 1, 4, ... 81</span>
 
343
<span class="go">285</span>
 
344
</pre></div>
 
345
</div>
 
346
</dd>
 
347
<dt id="term-gil">GIL</dt>
 
348
<dd>See <a class="reference internal" href="#term-global-interpreter-lock"><span class="xref std std-term">global interpreter lock</span></a>.</dd>
 
349
<dt id="term-global-interpreter-lock">global interpreter lock</dt>
 
350
<dd><p class="first">The mechanism used by the <a class="reference internal" href="#term-cpython"><span class="xref std std-term">CPython</span></a> interpreter to assure that
 
351
only one thread executes Python <a class="reference internal" href="#term-bytecode"><span class="xref std std-term">bytecode</span></a> at a time.
 
352
This simplifies the CPython implementation by making the object model
 
353
(including critical built-in types such as <a class="reference internal" href="library/stdtypes.html#dict" title="dict"><code class="xref py py-class docutils literal"><span class="pre">dict</span></code></a>) implicitly
 
354
safe against concurrent access.  Locking the entire interpreter
 
355
makes it easier for the interpreter to be multi-threaded, at the
 
356
expense of much of the parallelism afforded by multi-processor
 
357
machines.</p>
 
358
<p>However, some extension modules, either standard or third-party,
 
359
are designed so as to release the GIL when doing computationally-intensive
 
360
tasks such as compression or hashing.  Also, the GIL is always released
 
361
when doing I/O.</p>
 
362
<p class="last">Past efforts to create a &#8220;free-threaded&#8221; interpreter (one which locks
 
363
shared data at a much finer granularity) have not been successful
 
364
because performance suffered in the common single-processor case. It
 
365
is believed that overcoming this performance issue would make the
 
366
implementation much more complicated and therefore costlier to maintain.</p>
 
367
</dd>
 
368
<dt id="term-hashable">hashable</dt>
 
369
<dd><p class="first">An object is <em>hashable</em> if it has a hash value which never changes during
 
370
its lifetime (it needs a <a class="reference internal" href="reference/datamodel.html#object.__hash__" title="object.__hash__"><code class="xref py py-meth docutils literal"><span class="pre">__hash__()</span></code></a> method), and can be compared to
 
371
other objects (it needs an <a class="reference internal" href="reference/datamodel.html#object.__eq__" title="object.__eq__"><code class="xref py py-meth docutils literal"><span class="pre">__eq__()</span></code></a> or <a class="reference internal" href="reference/datamodel.html#object.__cmp__" title="object.__cmp__"><code class="xref py py-meth docutils literal"><span class="pre">__cmp__()</span></code></a> method).
 
372
Hashable objects which compare equal must have the same hash value.</p>
 
373
<p>Hashability makes an object usable as a dictionary key and a set member,
 
374
because these data structures use the hash value internally.</p>
 
375
<p class="last">All of Python&#8217;s immutable built-in objects are hashable, while no mutable
 
376
containers (such as lists or dictionaries) are.  Objects which are
 
377
instances of user-defined classes are hashable by default; they all
 
378
compare unequal (except with themselves), and their hash value is derived
 
379
from their <a class="reference internal" href="library/functions.html#id" title="id"><code class="xref py py-func docutils literal"><span class="pre">id()</span></code></a>.</p>
 
380
</dd>
 
381
<dt id="term-idle">IDLE</dt>
 
382
<dd>An Integrated Development Environment for Python.  IDLE is a basic editor
 
383
and interpreter environment which ships with the standard distribution of
 
384
Python.</dd>
 
385
<dt id="term-immutable">immutable</dt>
 
386
<dd>An object with a fixed value.  Immutable objects include numbers, strings and
 
387
tuples.  Such an object cannot be altered.  A new object has to
 
388
be created if a different value has to be stored.  They play an important
 
389
role in places where a constant hash value is needed, for example as a key
 
390
in a dictionary.</dd>
 
391
<dt id="term-integer-division">integer division</dt>
 
392
<dd>Mathematical division discarding any remainder.  For example, the
 
393
expression <code class="docutils literal"><span class="pre">11/4</span></code> currently evaluates to <code class="docutils literal"><span class="pre">2</span></code> in contrast to the
 
394
<code class="docutils literal"><span class="pre">2.75</span></code> returned by float division.  Also called <em>floor division</em>.
 
395
When dividing two integers the outcome will always be another integer
 
396
(having the floor function applied to it). However, if one of the operands
 
397
is another numeric type (such as a <a class="reference internal" href="library/functions.html#float" title="float"><code class="xref py py-class docutils literal"><span class="pre">float</span></code></a>), the result will be
 
398
coerced (see <a class="reference internal" href="#term-coercion"><span class="xref std std-term">coercion</span></a>) to a common type.  For example, an integer
 
399
divided by a float will result in a float value, possibly with a decimal
 
400
fraction.  Integer division can be forced by using the <code class="docutils literal"><span class="pre">//</span></code> operator
 
401
instead of the <code class="docutils literal"><span class="pre">/</span></code> operator.  See also <a class="reference internal" href="#term-future"><span class="xref std std-term">__future__</span></a>.</dd>
 
402
<dt id="term-importing">importing</dt>
 
403
<dd>The process by which Python code in one module is made available to
 
404
Python code in another module.</dd>
 
405
<dt id="term-importer">importer</dt>
 
406
<dd>An object that both finds and loads a module; both a
 
407
<a class="reference internal" href="#term-finder"><span class="xref std std-term">finder</span></a> and <a class="reference internal" href="#term-loader"><span class="xref std std-term">loader</span></a> object.</dd>
 
408
<dt id="term-interactive">interactive</dt>
 
409
<dd>Python has an interactive interpreter which means you can enter
 
410
statements and expressions at the interpreter prompt, immediately
 
411
execute them and see their results.  Just launch <code class="docutils literal"><span class="pre">python</span></code> with no
 
412
arguments (possibly by selecting it from your computer&#8217;s main
 
413
menu). It is a very powerful way to test out new ideas or inspect
 
414
modules and packages (remember <code class="docutils literal"><span class="pre">help(x)</span></code>).</dd>
 
415
<dt id="term-interpreted">interpreted</dt>
 
416
<dd>Python is an interpreted language, as opposed to a compiled one,
 
417
though the distinction can be blurry because of the presence of the
 
418
bytecode compiler.  This means that source files can be run directly
 
419
without explicitly creating an executable which is then run.
 
420
Interpreted languages typically have a shorter development/debug cycle
 
421
than compiled ones, though their programs generally also run more
 
422
slowly.  See also <a class="reference internal" href="#term-interactive"><span class="xref std std-term">interactive</span></a>.</dd>
 
423
<dt id="term-iterable">iterable</dt>
 
424
<dd>An object capable of returning its members one at a time. Examples of
 
425
iterables include all sequence types (such as <a class="reference internal" href="library/functions.html#list" title="list"><code class="xref py py-class docutils literal"><span class="pre">list</span></code></a>, <a class="reference internal" href="library/functions.html#str" title="str"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>,
 
426
and <a class="reference internal" href="library/functions.html#tuple" title="tuple"><code class="xref py py-class docutils literal"><span class="pre">tuple</span></code></a>) and some non-sequence types like <a class="reference internal" href="library/stdtypes.html#dict" title="dict"><code class="xref py py-class docutils literal"><span class="pre">dict</span></code></a>
 
427
and <a class="reference internal" href="library/functions.html#file" title="file"><code class="xref py py-class docutils literal"><span class="pre">file</span></code></a> and objects of any classes you define
 
428
with an <a class="reference internal" href="reference/datamodel.html#object.__iter__" title="object.__iter__"><code class="xref py py-meth docutils literal"><span class="pre">__iter__()</span></code></a> or <a class="reference internal" href="reference/datamodel.html#object.__getitem__" title="object.__getitem__"><code class="xref py py-meth docutils literal"><span class="pre">__getitem__()</span></code></a> method.  Iterables can be
 
429
used in a <a class="reference internal" href="reference/compound_stmts.html#for"><code class="xref std std-keyword docutils literal"><span class="pre">for</span></code></a> loop and in many other places where a sequence is
 
430
needed (<a class="reference internal" href="library/functions.html#zip" title="zip"><code class="xref py py-func docutils literal"><span class="pre">zip()</span></code></a>, <a class="reference internal" href="library/functions.html#map" title="map"><code class="xref py py-func docutils literal"><span class="pre">map()</span></code></a>, ...).  When an iterable object is passed
 
431
as an argument to the built-in function <a class="reference internal" href="library/functions.html#iter" title="iter"><code class="xref py py-func docutils literal"><span class="pre">iter()</span></code></a>, it returns an
 
432
iterator for the object.  This iterator is good for one pass over the set
 
433
of values.  When using iterables, it is usually not necessary to call
 
434
<a class="reference internal" href="library/functions.html#iter" title="iter"><code class="xref py py-func docutils literal"><span class="pre">iter()</span></code></a> or deal with iterator objects yourself.  The <code class="docutils literal"><span class="pre">for</span></code>
 
435
statement does that automatically for you, creating a temporary unnamed
 
436
variable to hold the iterator for the duration of the loop.  See also
 
437
<a class="reference internal" href="#term-iterator"><span class="xref std std-term">iterator</span></a>, <a class="reference internal" href="#term-sequence"><span class="xref std std-term">sequence</span></a>, and <a class="reference internal" href="#term-generator"><span class="xref std std-term">generator</span></a>.</dd>
 
438
<dt id="term-iterator">iterator</dt>
 
439
<dd><p class="first">An object representing a stream of data.  Repeated calls to the iterator&#8217;s
 
440
<a class="reference internal" href="reference/expressions.html#generator.next" title="generator.next"><code class="xref py py-meth docutils literal"><span class="pre">next()</span></code></a> method return successive items in the stream.  When no more
 
441
data are available a <a class="reference internal" href="library/exceptions.html#exceptions.StopIteration" title="exceptions.StopIteration"><code class="xref py py-exc docutils literal"><span class="pre">StopIteration</span></code></a> exception is raised instead.  At
 
442
this point, the iterator object is exhausted and any further calls to its
 
443
<a class="reference internal" href="reference/expressions.html#generator.next" title="generator.next"><code class="xref py py-meth docutils literal"><span class="pre">next()</span></code></a> method just raise <a class="reference internal" href="library/exceptions.html#exceptions.StopIteration" title="exceptions.StopIteration"><code class="xref py py-exc docutils literal"><span class="pre">StopIteration</span></code></a> again.  Iterators are
 
444
required to have an <a class="reference internal" href="reference/datamodel.html#object.__iter__" title="object.__iter__"><code class="xref py py-meth docutils literal"><span class="pre">__iter__()</span></code></a> method that returns the iterator
 
445
object itself so every iterator is also iterable and may be used in most
 
446
places where other iterables are accepted.  One notable exception is code
 
447
which attempts multiple iteration passes.  A container object (such as a
 
448
<a class="reference internal" href="library/functions.html#list" title="list"><code class="xref py py-class docutils literal"><span class="pre">list</span></code></a>) produces a fresh new iterator each time you pass it to the
 
449
<a class="reference internal" href="library/functions.html#iter" title="iter"><code class="xref py py-func docutils literal"><span class="pre">iter()</span></code></a> function or use it in a <a class="reference internal" href="reference/compound_stmts.html#for"><code class="xref std std-keyword docutils literal"><span class="pre">for</span></code></a> loop.  Attempting this
 
450
with an iterator will just return the same exhausted iterator object used
 
451
in the previous iteration pass, making it appear like an empty container.</p>
 
452
<p class="last">More information can be found in <a class="reference internal" href="library/stdtypes.html#typeiter"><span>Iterator Types</span></a>.</p>
 
453
</dd>
 
454
<dt id="term-key-function">key function</dt>
 
455
<dd><p class="first">A key function or collation function is a callable that returns a value
 
456
used for sorting or ordering.  For example, <a class="reference internal" href="library/locale.html#locale.strxfrm" title="locale.strxfrm"><code class="xref py py-func docutils literal"><span class="pre">locale.strxfrm()</span></code></a> is
 
457
used to produce a sort key that is aware of locale specific sort
 
458
conventions.</p>
 
459
<p>A number of tools in Python accept key functions to control how elements
 
460
are ordered or grouped.  They include <a class="reference internal" href="library/functions.html#min" title="min"><code class="xref py py-func docutils literal"><span class="pre">min()</span></code></a>, <a class="reference internal" href="library/functions.html#max" title="max"><code class="xref py py-func docutils literal"><span class="pre">max()</span></code></a>,
 
461
<a class="reference internal" href="library/functions.html#sorted" title="sorted"><code class="xref py py-func docutils literal"><span class="pre">sorted()</span></code></a>, <code class="xref py py-meth docutils literal"><span class="pre">list.sort()</span></code>, <a class="reference internal" href="library/heapq.html#heapq.nsmallest" title="heapq.nsmallest"><code class="xref py py-func docutils literal"><span class="pre">heapq.nsmallest()</span></code></a>,
 
462
<a class="reference internal" href="library/heapq.html#heapq.nlargest" title="heapq.nlargest"><code class="xref py py-func docutils literal"><span class="pre">heapq.nlargest()</span></code></a>, and <a class="reference internal" href="library/itertools.html#itertools.groupby" title="itertools.groupby"><code class="xref py py-func docutils literal"><span class="pre">itertools.groupby()</span></code></a>.</p>
 
463
<p class="last">There are several ways to create a key function.  For example. the
 
464
<a class="reference internal" href="library/stdtypes.html#str.lower" title="str.lower"><code class="xref py py-meth docutils literal"><span class="pre">str.lower()</span></code></a> method can serve as a key function for case insensitive
 
465
sorts.  Alternatively, an ad-hoc key function can be built from a
 
466
<a class="reference internal" href="reference/expressions.html#lambda"><code class="xref std std-keyword docutils literal"><span class="pre">lambda</span></code></a> expression such as <code class="docutils literal"><span class="pre">lambda</span> <span class="pre">r:</span> <span class="pre">(r[0],</span> <span class="pre">r[2])</span></code>.  Also,
 
467
the <a class="reference internal" href="library/operator.html#module-operator" title="operator: Functions corresponding to the standard operators."><code class="xref py py-mod docutils literal"><span class="pre">operator</span></code></a> module provides three key function constructors:
 
468
<a class="reference internal" href="library/operator.html#operator.attrgetter" title="operator.attrgetter"><code class="xref py py-func docutils literal"><span class="pre">attrgetter()</span></code></a>, <a class="reference internal" href="library/operator.html#operator.itemgetter" title="operator.itemgetter"><code class="xref py py-func docutils literal"><span class="pre">itemgetter()</span></code></a>, and
 
469
<a class="reference internal" href="library/operator.html#operator.methodcaller" title="operator.methodcaller"><code class="xref py py-func docutils literal"><span class="pre">methodcaller()</span></code></a>.  See the <a class="reference internal" href="howto/sorting.html#sortinghowto"><span>Sorting HOW TO</span></a> for examples of how to create and use key functions.</p>
 
470
</dd>
 
471
<dt id="term-keyword-argument">keyword argument</dt>
 
472
<dd>See <a class="reference internal" href="#term-argument"><span class="xref std std-term">argument</span></a>.</dd>
 
473
<dt id="term-lambda">lambda</dt>
 
474
<dd>An anonymous inline function consisting of a single <a class="reference internal" href="#term-expression"><span class="xref std std-term">expression</span></a>
 
475
which is evaluated when the function is called.  The syntax to create
 
476
a lambda function is <code class="docutils literal"><span class="pre">lambda</span> <span class="pre">[arguments]:</span> <span class="pre">expression</span></code></dd>
 
477
<dt id="term-lbyl">LBYL</dt>
 
478
<dd><p class="first">Look before you leap.  This coding style explicitly tests for
 
479
pre-conditions before making calls or lookups.  This style contrasts with
 
480
the <a class="reference internal" href="#term-eafp"><span class="xref std std-term">EAFP</span></a> approach and is characterized by the presence of many
 
481
<a class="reference internal" href="reference/compound_stmts.html#if"><code class="xref std std-keyword docutils literal"><span class="pre">if</span></code></a> statements.</p>
 
482
<p class="last">In a multi-threaded environment, the LBYL approach can risk introducing a
 
483
race condition between &#8220;the looking&#8221; and &#8220;the leaping&#8221;.  For example, the
 
484
code, <code class="docutils literal"><span class="pre">if</span> <span class="pre">key</span> <span class="pre">in</span> <span class="pre">mapping:</span> <span class="pre">return</span> <span class="pre">mapping[key]</span></code> can fail if another
 
485
thread removes <em>key</em> from <em>mapping</em> after the test, but before the lookup.
 
486
This issue can be solved with locks or by using the EAFP approach.</p>
 
487
</dd>
 
488
<dt id="term-list">list</dt>
 
489
<dd>A built-in Python <a class="reference internal" href="#term-sequence"><span class="xref std std-term">sequence</span></a>.  Despite its name it is more akin
 
490
to an array in other languages than to a linked list since access to
 
491
elements are O(1).</dd>
 
492
<dt id="term-list-comprehension">list comprehension</dt>
 
493
<dd>A compact way to process all or part of the elements in a sequence and
 
494
return a list with the results.  <code class="docutils literal"><span class="pre">result</span> <span class="pre">=</span> <span class="pre">[&quot;0x%02x&quot;</span> <span class="pre">%</span> <span class="pre">x</span> <span class="pre">for</span> <span class="pre">x</span> <span class="pre">in</span>
 
495
<span class="pre">range(256)</span> <span class="pre">if</span> <span class="pre">x</span> <span class="pre">%</span> <span class="pre">2</span> <span class="pre">==</span> <span class="pre">0]</span></code> generates a list of strings containing
 
496
even hex numbers (0x..) in the range from 0 to 255. The <a class="reference internal" href="reference/compound_stmts.html#if"><code class="xref std std-keyword docutils literal"><span class="pre">if</span></code></a>
 
497
clause is optional.  If omitted, all elements in <code class="docutils literal"><span class="pre">range(256)</span></code> are
 
498
processed.</dd>
 
499
<dt id="term-loader">loader</dt>
 
500
<dd>An object that loads a module. It must define a method named
 
501
<code class="xref py py-meth docutils literal"><span class="pre">load_module()</span></code>. A loader is typically returned by a
 
502
<a class="reference internal" href="#term-finder"><span class="xref std std-term">finder</span></a>. See <span class="target" id="index-5"></span><a class="pep reference external" href="https://www.python.org/dev/peps/pep-0302"><strong>PEP 302</strong></a> for details.</dd>
 
503
<dt id="term-mapping">mapping</dt>
 
504
<dd>A container object that supports arbitrary key lookups and implements the
 
505
methods specified in the <a class="reference internal" href="library/collections.html#collections.Mapping" title="collections.Mapping"><code class="xref py py-class docutils literal"><span class="pre">Mapping</span></code></a> or
 
506
<a class="reference internal" href="library/collections.html#collections.MutableMapping" title="collections.MutableMapping"><code class="xref py py-class docutils literal"><span class="pre">MutableMapping</span></code></a>
 
507
<a class="reference internal" href="library/collections.html#collections-abstract-base-classes"><span>abstract base classes</span></a>.  Examples
 
508
include <a class="reference internal" href="library/stdtypes.html#dict" title="dict"><code class="xref py py-class docutils literal"><span class="pre">dict</span></code></a>, <a class="reference internal" href="library/collections.html#collections.defaultdict" title="collections.defaultdict"><code class="xref py py-class docutils literal"><span class="pre">collections.defaultdict</span></code></a>,
 
509
<a class="reference internal" href="library/collections.html#collections.OrderedDict" title="collections.OrderedDict"><code class="xref py py-class docutils literal"><span class="pre">collections.OrderedDict</span></code></a> and <a class="reference internal" href="library/collections.html#collections.Counter" title="collections.Counter"><code class="xref py py-class docutils literal"><span class="pre">collections.Counter</span></code></a>.</dd>
 
510
<dt id="term-metaclass">metaclass</dt>
 
511
<dd><p class="first">The class of a class.  Class definitions create a class name, a class
 
512
dictionary, and a list of base classes.  The metaclass is responsible for
 
513
taking those three arguments and creating the class.  Most object oriented
 
514
programming languages provide a default implementation.  What makes Python
 
515
special is that it is possible to create custom metaclasses.  Most users
 
516
never need this tool, but when the need arises, metaclasses can provide
 
517
powerful, elegant solutions.  They have been used for logging attribute
 
518
access, adding thread-safety, tracking object creation, implementing
 
519
singletons, and many other tasks.</p>
 
520
<p class="last">More information can be found in <a class="reference internal" href="reference/datamodel.html#metaclasses"><span>Customizing class creation</span></a>.</p>
 
521
</dd>
 
522
<dt id="term-method">method</dt>
 
523
<dd>A function which is defined inside a class body.  If called as an attribute
 
524
of an instance of that class, the method will get the instance object as
 
525
its first <a class="reference internal" href="#term-argument"><span class="xref std std-term">argument</span></a> (which is usually called <code class="docutils literal"><span class="pre">self</span></code>).
 
526
See <a class="reference internal" href="#term-function"><span class="xref std std-term">function</span></a> and <a class="reference internal" href="#term-nested-scope"><span class="xref std std-term">nested scope</span></a>.</dd>
 
527
<dt id="term-method-resolution-order">method resolution order</dt>
 
528
<dd>Method Resolution Order is the order in which base classes are searched
 
529
for a member during lookup. See <a class="reference external" href="https://www.python.org/download/releases/2.3/mro/">The Python 2.3 Method Resolution Order</a> for details of the
 
530
algorithm used by the Python interpreter since the 2.3 release.</dd>
 
531
<dt id="term-module">module</dt>
 
532
<dd><p class="first">An object that serves as an organizational unit of Python code.  Modules
 
533
have a namespace containing arbitrary Python objects.  Modules are loaded
 
534
into Python by the process of <a class="reference internal" href="#term-importing"><span class="xref std std-term">importing</span></a>.</p>
 
535
<p class="last">See also <a class="reference internal" href="#term-package"><span class="xref std std-term">package</span></a>.</p>
 
536
</dd>
 
537
<dt id="term-mro">MRO</dt>
 
538
<dd>See <a class="reference internal" href="#term-method-resolution-order"><span class="xref std std-term">method resolution order</span></a>.</dd>
 
539
<dt id="term-mutable">mutable</dt>
 
540
<dd>Mutable objects can change their value but keep their <a class="reference internal" href="library/functions.html#id" title="id"><code class="xref py py-func docutils literal"><span class="pre">id()</span></code></a>.  See
 
541
also <a class="reference internal" href="#term-immutable"><span class="xref std std-term">immutable</span></a>.</dd>
 
542
<dt id="term-named-tuple">named tuple</dt>
 
543
<dd><p class="first">Any tuple-like class whose indexable elements are also accessible using
 
544
named attributes (for example, <a class="reference internal" href="library/time.html#time.localtime" title="time.localtime"><code class="xref py py-func docutils literal"><span class="pre">time.localtime()</span></code></a> returns a
 
545
tuple-like object where the <em>year</em> is accessible either with an
 
546
index such as <code class="docutils literal"><span class="pre">t[0]</span></code> or with a named attribute like <code class="docutils literal"><span class="pre">t.tm_year</span></code>).</p>
 
547
<p class="last">A named tuple can be a built-in type such as <a class="reference internal" href="library/time.html#time.struct_time" title="time.struct_time"><code class="xref py py-class docutils literal"><span class="pre">time.struct_time</span></code></a>,
 
548
or it can be created with a regular class definition.  A full featured
 
549
named tuple can also be created with the factory function
 
550
<a class="reference internal" href="library/collections.html#collections.namedtuple" title="collections.namedtuple"><code class="xref py py-func docutils literal"><span class="pre">collections.namedtuple()</span></code></a>.  The latter approach automatically
 
551
provides extra features such as a self-documenting representation like
 
552
<code class="docutils literal"><span class="pre">Employee(name='jones',</span> <span class="pre">title='programmer')</span></code>.</p>
 
553
</dd>
 
554
<dt id="term-namespace">namespace</dt>
 
555
<dd>The place where a variable is stored.  Namespaces are implemented as
 
556
dictionaries.  There are the local, global and built-in namespaces as well
 
557
as nested namespaces in objects (in methods).  Namespaces support
 
558
modularity by preventing naming conflicts.  For instance, the functions
 
559
<code class="xref py py-func docutils literal"><span class="pre">__builtin__.open()</span></code> and <a class="reference internal" href="library/os.html#os.open" title="os.open"><code class="xref py py-func docutils literal"><span class="pre">os.open()</span></code></a> are distinguished by their
 
560
namespaces.  Namespaces also aid readability and maintainability by making
 
561
it clear which module implements a function.  For instance, writing
 
562
<a class="reference internal" href="library/random.html#random.seed" title="random.seed"><code class="xref py py-func docutils literal"><span class="pre">random.seed()</span></code></a> or <a class="reference internal" href="library/itertools.html#itertools.izip" title="itertools.izip"><code class="xref py py-func docutils literal"><span class="pre">itertools.izip()</span></code></a> makes it clear that those
 
563
functions are implemented by the <a class="reference internal" href="library/random.html#module-random" title="random: Generate pseudo-random numbers with various common distributions."><code class="xref py py-mod docutils literal"><span class="pre">random</span></code></a> and <a class="reference internal" href="library/itertools.html#module-itertools" title="itertools: Functions creating iterators for efficient looping."><code class="xref py py-mod docutils literal"><span class="pre">itertools</span></code></a>
 
564
modules, respectively.</dd>
 
565
<dt id="term-nested-scope">nested scope</dt>
 
566
<dd>The ability to refer to a variable in an enclosing definition.  For
 
567
instance, a function defined inside another function can refer to
 
568
variables in the outer function.  Note that nested scopes work only for
 
569
reference and not for assignment which will always write to the innermost
 
570
scope.  In contrast, local variables both read and write in the innermost
 
571
scope.  Likewise, global variables read and write to the global namespace.</dd>
 
572
<dt id="term-new-style-class">new-style class</dt>
 
573
<dd><p class="first">Any class which inherits from <a class="reference internal" href="library/functions.html#object" title="object"><code class="xref py py-class docutils literal"><span class="pre">object</span></code></a>.  This includes all built-in
 
574
types like <a class="reference internal" href="library/functions.html#list" title="list"><code class="xref py py-class docutils literal"><span class="pre">list</span></code></a> and <a class="reference internal" href="library/stdtypes.html#dict" title="dict"><code class="xref py py-class docutils literal"><span class="pre">dict</span></code></a>.  Only new-style classes can
 
575
use Python&#8217;s newer, versatile features like <code class="xref py py-attr docutils literal"><span class="pre">__slots__</span></code>,
 
576
descriptors, properties, and <a class="reference internal" href="reference/datamodel.html#object.__getattribute__" title="object.__getattribute__"><code class="xref py py-meth docutils literal"><span class="pre">__getattribute__()</span></code></a>.</p>
 
577
<p class="last">More information can be found in <a class="reference internal" href="reference/datamodel.html#newstyle"><span>New-style and classic classes</span></a>.</p>
 
578
</dd>
 
579
<dt id="term-object">object</dt>
 
580
<dd>Any data with state (attributes or value) and defined behavior
 
581
(methods).  Also the ultimate base class of any <a class="reference internal" href="#term-new-style-class"><span class="xref std std-term">new-style
 
582
class</span></a>.</dd>
 
583
<dt id="term-package">package</dt>
 
584
<dd>A Python <a class="reference internal" href="#term-module"><span class="xref std std-term">module</span></a> which can contain submodules or recursively,
 
585
subpackages.  Technically, a package is a Python module with an
 
586
<code class="docutils literal"><span class="pre">__path__</span></code> attribute.</dd>
 
587
<dt id="term-parameter">parameter</dt>
 
588
<dd><p class="first">A named entity in a <a class="reference internal" href="#term-function"><span class="xref std std-term">function</span></a> (or method) definition that
 
589
specifies an <a class="reference internal" href="#term-argument"><span class="xref std std-term">argument</span></a> (or in some cases, arguments) that the
 
590
function can accept.  There are four types of parameters:</p>
 
591
<ul>
 
592
<li><p class="first"><em class="dfn">positional-or-keyword</em>: specifies an argument that can be passed
 
593
either <a class="reference internal" href="#term-argument"><span class="xref std std-term">positionally</span></a> or as a <a class="reference internal" href="#term-argument"><span class="xref std std-term">keyword argument</span></a>.  This is the default kind of parameter, for example <em>foo</em>
 
594
and <em>bar</em> in the following:</p>
 
595
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">func</span><span class="p">(</span><span class="n">foo</span><span class="p">,</span> <span class="n">bar</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span> <span class="o">...</span>
 
596
</pre></div>
 
597
</div>
 
598
</li>
 
599
<li><p class="first"><em class="dfn">positional-only</em>: specifies an argument that can be supplied only
 
600
by position.  Python has no syntax for defining positional-only
 
601
parameters.  However, some built-in functions have positional-only
 
602
parameters (e.g. <a class="reference internal" href="library/functions.html#abs" title="abs"><code class="xref py py-func docutils literal"><span class="pre">abs()</span></code></a>).</p>
 
603
</li>
 
604
<li><p class="first"><em class="dfn">var-positional</em>: specifies that an arbitrary sequence of
 
605
positional arguments can be provided (in addition to any positional
 
606
arguments already accepted by other parameters).  Such a parameter can
 
607
be defined by prepending the parameter name with <code class="docutils literal"><span class="pre">*</span></code>, for example
 
608
<em>args</em> in the following:</p>
 
609
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">func</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> <span class="o">...</span>
 
610
</pre></div>
 
611
</div>
 
612
</li>
 
613
<li><p class="first"><em class="dfn">var-keyword</em>: specifies that arbitrarily many keyword arguments
 
614
can be provided (in addition to any keyword arguments already accepted
 
615
by other parameters).  Such a parameter can be defined by prepending
 
616
the parameter name with <code class="docutils literal"><span class="pre">**</span></code>, for example <em>kwargs</em> in the example
 
617
above.</p>
 
618
</li>
 
619
</ul>
 
620
<p>Parameters can specify both optional and required arguments, as well as
 
621
default values for some optional arguments.</p>
 
622
<p class="last">See also the <a class="reference internal" href="#term-argument"><span class="xref std std-term">argument</span></a> glossary entry, the FAQ question on
 
623
<a class="reference internal" href="faq/programming.html#faq-argument-vs-parameter"><span>the difference between arguments and parameters</span></a>, and the <a class="reference internal" href="reference/compound_stmts.html#function"><span>Function definitions</span></a> section.</p>
 
624
</dd>
 
625
<dt id="term-positional-argument">positional argument</dt>
 
626
<dd>See <a class="reference internal" href="#term-argument"><span class="xref std std-term">argument</span></a>.</dd>
 
627
<dt id="term-python-3000">Python 3000</dt>
 
628
<dd>Nickname for the Python 3.x release line (coined long ago when the release
 
629
of version 3 was something in the distant future.)  This is also
 
630
abbreviated &#8220;Py3k&#8221;.</dd>
 
631
<dt id="term-pythonic">Pythonic</dt>
 
632
<dd><p class="first">An idea or piece of code which closely follows the most common idioms
 
633
of the Python language, rather than implementing code using concepts
 
634
common to other languages.  For example, a common idiom in Python is
 
635
to loop over all elements of an iterable using a <a class="reference internal" href="reference/compound_stmts.html#for"><code class="xref std std-keyword docutils literal"><span class="pre">for</span></code></a>
 
636
statement.  Many other languages don&#8217;t have this type of construct, so
 
637
people unfamiliar with Python sometimes use a numerical counter instead:</p>
 
638
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">food</span><span class="p">)):</span>
 
639
    <span class="k">print</span> <span class="n">food</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>
 
640
</pre></div>
 
641
</div>
 
642
<p>As opposed to the cleaner, Pythonic method:</p>
 
643
<div class="last highlight-python"><div class="highlight"><pre><span></span><span class="k">for</span> <span class="n">piece</span> <span class="ow">in</span> <span class="n">food</span><span class="p">:</span>
 
644
    <span class="k">print</span> <span class="n">piece</span>
 
645
</pre></div>
 
646
</div>
 
647
</dd>
 
648
<dt id="term-reference-count">reference count</dt>
 
649
<dd>The number of references to an object.  When the reference count of an
 
650
object drops to zero, it is deallocated.  Reference counting is
 
651
generally not visible to Python code, but it is a key element of the
 
652
<a class="reference internal" href="#term-cpython"><span class="xref std std-term">CPython</span></a> implementation.  The <a class="reference internal" href="library/sys.html#module-sys" title="sys: Access system-specific parameters and functions."><code class="xref py py-mod docutils literal"><span class="pre">sys</span></code></a> module defines a
 
653
<a class="reference internal" href="library/sys.html#sys.getrefcount" title="sys.getrefcount"><code class="xref py py-func docutils literal"><span class="pre">getrefcount()</span></code></a> function that programmers can call to return the
 
654
reference count for a particular object.</dd>
 
655
<dt id="term-slots">__slots__</dt>
 
656
<dd>A declaration inside a <a class="reference internal" href="#term-new-style-class"><span class="xref std std-term">new-style class</span></a> that saves memory by
 
657
pre-declaring space for instance attributes and eliminating instance
 
658
dictionaries.  Though popular, the technique is somewhat tricky to get
 
659
right and is best reserved for rare cases where there are large numbers of
 
660
instances in a memory-critical application.</dd>
 
661
<dt id="term-sequence">sequence</dt>
 
662
<dd>An <a class="reference internal" href="#term-iterable"><span class="xref std std-term">iterable</span></a> which supports efficient element access using integer
 
663
indices via the <a class="reference internal" href="reference/datamodel.html#object.__getitem__" title="object.__getitem__"><code class="xref py py-meth docutils literal"><span class="pre">__getitem__()</span></code></a> special method and defines a
 
664
<a class="reference internal" href="library/functions.html#len" title="len"><code class="xref py py-meth docutils literal"><span class="pre">len()</span></code></a> method that returns the length of the sequence.
 
665
Some built-in sequence types are <a class="reference internal" href="library/functions.html#list" title="list"><code class="xref py py-class docutils literal"><span class="pre">list</span></code></a>, <a class="reference internal" href="library/functions.html#str" title="str"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>,
 
666
<a class="reference internal" href="library/functions.html#tuple" title="tuple"><code class="xref py py-class docutils literal"><span class="pre">tuple</span></code></a>, and <a class="reference internal" href="library/functions.html#unicode" title="unicode"><code class="xref py py-class docutils literal"><span class="pre">unicode</span></code></a>. Note that <a class="reference internal" href="library/stdtypes.html#dict" title="dict"><code class="xref py py-class docutils literal"><span class="pre">dict</span></code></a> also
 
667
supports <a class="reference internal" href="reference/datamodel.html#object.__getitem__" title="object.__getitem__"><code class="xref py py-meth docutils literal"><span class="pre">__getitem__()</span></code></a> and <a class="reference internal" href="reference/datamodel.html#object.__len__" title="object.__len__"><code class="xref py py-meth docutils literal"><span class="pre">__len__()</span></code></a>, but is considered a
 
668
mapping rather than a sequence because the lookups use arbitrary
 
669
<a class="reference internal" href="#term-immutable"><span class="xref std std-term">immutable</span></a> keys rather than integers.</dd>
 
670
<dt id="term-slice">slice</dt>
 
671
<dd>An object usually containing a portion of a <a class="reference internal" href="#term-sequence"><span class="xref std std-term">sequence</span></a>.  A slice is
 
672
created using the subscript notation, <code class="docutils literal"><span class="pre">[]</span></code> with colons between numbers
 
673
when several are given, such as in <code class="docutils literal"><span class="pre">variable_name[1:3:5]</span></code>.  The bracket
 
674
(subscript) notation uses <a class="reference internal" href="library/functions.html#slice" title="slice"><code class="xref py py-class docutils literal"><span class="pre">slice</span></code></a> objects internally (or in older
 
675
versions, <a class="reference internal" href="reference/datamodel.html#object.__getslice__" title="object.__getslice__"><code class="xref py py-meth docutils literal"><span class="pre">__getslice__()</span></code></a> and <a class="reference internal" href="reference/datamodel.html#object.__setslice__" title="object.__setslice__"><code class="xref py py-meth docutils literal"><span class="pre">__setslice__()</span></code></a>).</dd>
 
676
<dt id="term-special-method">special method</dt>
 
677
<dd>A method that is called implicitly by Python to execute a certain
 
678
operation on a type, such as addition.  Such methods have names starting
 
679
and ending with double underscores.  Special methods are documented in
 
680
<a class="reference internal" href="reference/datamodel.html#specialnames"><span>Special method names</span></a>.</dd>
 
681
<dt id="term-statement">statement</dt>
 
682
<dd>A statement is part of a suite (a &#8220;block&#8221; of code).  A statement is either
 
683
an <a class="reference internal" href="#term-expression"><span class="xref std std-term">expression</span></a> or one of several constructs with a keyword, such
 
684
as <a class="reference internal" href="reference/compound_stmts.html#if"><code class="xref std std-keyword docutils literal"><span class="pre">if</span></code></a>, <a class="reference internal" href="reference/compound_stmts.html#while"><code class="xref std std-keyword docutils literal"><span class="pre">while</span></code></a> or <a class="reference internal" href="reference/compound_stmts.html#for"><code class="xref std std-keyword docutils literal"><span class="pre">for</span></code></a>.</dd>
 
685
<dt id="term-struct-sequence">struct sequence</dt>
 
686
<dd>A tuple with named elements. Struct sequences expose an interface similiar
 
687
to <a class="reference internal" href="#term-named-tuple"><span class="xref std std-term">named tuple</span></a> in that elements can either be accessed either by
 
688
index or as an attribute. However, they do not have any of the named tuple
 
689
methods like <a class="reference internal" href="library/collections.html#collections.somenamedtuple._make" title="collections.somenamedtuple._make"><code class="xref py py-meth docutils literal"><span class="pre">_make()</span></code></a> or
 
690
<a class="reference internal" href="library/collections.html#collections.somenamedtuple._asdict" title="collections.somenamedtuple._asdict"><code class="xref py py-meth docutils literal"><span class="pre">_asdict()</span></code></a>. Examples of struct sequences
 
691
include <a class="reference internal" href="library/sys.html#sys.float_info" title="sys.float_info"><code class="xref py py-data docutils literal"><span class="pre">sys.float_info</span></code></a> and the return value of <a class="reference internal" href="library/os.html#os.stat" title="os.stat"><code class="xref py py-func docutils literal"><span class="pre">os.stat()</span></code></a>.</dd>
 
692
<dt id="term-triple-quoted-string">triple-quoted string</dt>
 
693
<dd>A string which is bound by three instances of either a quotation mark
 
694
(&#8221;) or an apostrophe (&#8216;).  While they don&#8217;t provide any functionality
 
695
not available with single-quoted strings, they are useful for a number
 
696
of reasons.  They allow you to include unescaped single and double
 
697
quotes within a string and they can span multiple lines without the
 
698
use of the continuation character, making them especially useful when
 
699
writing docstrings.</dd>
 
700
<dt id="term-type">type</dt>
 
701
<dd>The type of a Python object determines what kind of object it is; every
 
702
object has a type.  An object&#8217;s type is accessible as its
 
703
<a class="reference internal" href="library/stdtypes.html#instance.__class__" title="instance.__class__"><code class="xref py py-attr docutils literal"><span class="pre">__class__</span></code></a> attribute or can be retrieved with
 
704
<code class="docutils literal"><span class="pre">type(obj)</span></code>.</dd>
 
705
<dt id="term-universal-newlines">universal newlines</dt>
 
706
<dd>A manner of interpreting text streams in which all of the following are
 
707
recognized as ending a line: the Unix end-of-line convention <code class="docutils literal"><span class="pre">'\n'</span></code>,
 
708
the Windows convention <code class="docutils literal"><span class="pre">'\r\n'</span></code>, and the old Macintosh convention
 
709
<code class="docutils literal"><span class="pre">'\r'</span></code>.  See <span class="target" id="index-6"></span><a class="pep reference external" href="https://www.python.org/dev/peps/pep-0278"><strong>PEP 278</strong></a> and <span class="target" id="index-7"></span><a class="pep reference external" href="https://www.python.org/dev/peps/pep-3116"><strong>PEP 3116</strong></a>, as well as
 
710
<a class="reference internal" href="library/stdtypes.html#str.splitlines" title="str.splitlines"><code class="xref py py-func docutils literal"><span class="pre">str.splitlines()</span></code></a> for an additional use.</dd>
 
711
<dt id="term-virtual-environment">virtual environment</dt>
 
712
<dd>A cooperatively isolated runtime environment that allows Python users
 
713
and applications to install and upgrade Python distribution packages
 
714
without interfering with the behaviour of other Python applications
 
715
running on the same system.</dd>
 
716
<dt id="term-virtual-machine">virtual machine</dt>
 
717
<dd>A computer defined entirely in software.  Python&#8217;s virtual machine
 
718
executes the <a class="reference internal" href="#term-bytecode"><span class="xref std std-term">bytecode</span></a> emitted by the bytecode compiler.</dd>
 
719
<dt id="term-zen-of-python">Zen of Python</dt>
 
720
<dd>Listing of Python design principles and philosophies that are helpful in
 
721
understanding and using the language.  The listing can be found by typing
 
722
&#8220;<code class="docutils literal"><span class="pre">import</span> <span class="pre">this</span></code>&#8221; at the interactive prompt.</dd>
 
723
</dl>
 
724
</div>
 
725
 
 
726
 
 
727
          </div>
 
728
        </div>
 
729
      </div>
 
730
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
 
731
        <div class="sphinxsidebarwrapper">
 
732
  <h4>Previous topic</h4>
 
733
  <p class="topless"><a href="faq/installed.html"
 
734
                        title="previous chapter">&#8220;Why is Python Installed on my Computer?&#8221; FAQ</a></p>
 
735
  <h4>Next topic</h4>
 
736
  <p class="topless"><a href="about.html"
 
737
                        title="next chapter">About these documents</a></p>
 
738
<h3>This Page</h3>
 
739
<ul class="this-page-menu">
 
740
  <li><a href="bugs.html">Report a Bug</a></li>
 
741
  <li><a href="_sources/glossary.txt"
 
742
         rel="nofollow">Show Source</a></li>
 
743
</ul>
 
744
 
 
745
<div id="searchbox" style="display: none" role="search">
 
746
  <h3>Quick search</h3>
 
747
    <form class="search" action="search.html" method="get">
 
748
      <input type="text" name="q" />
 
749
      <input type="submit" value="Go" />
 
750
      <input type="hidden" name="check_keywords" value="yes" />
 
751
      <input type="hidden" name="area" value="default" />
 
752
    </form>
 
753
    <p class="searchtip" style="font-size: 90%">
 
754
    Enter search terms or a module, class or function name.
 
755
    </p>
 
756
</div>
 
757
<script type="text/javascript">$('#searchbox').show(0);</script>
 
758
        </div>
 
759
      </div>
 
760
      <div class="clearer"></div>
 
761
    </div>  
 
762
    <div class="related" role="navigation" aria-label="related navigation">
 
763
      <h3>Navigation</h3>
 
764
      <ul>
 
765
        <li class="right" style="margin-right: 10px">
 
766
          <a href="genindex.html" title="General Index"
 
767
             >index</a></li>
 
768
        <li class="right" >
 
769
          <a href="py-modindex.html" title="Python Module Index"
 
770
             >modules</a> |</li>
 
771
        <li class="right" >
 
772
          <a href="about.html" title="About these documents"
 
773
             >next</a> |</li>
 
774
        <li class="right" >
 
775
          <a href="faq/installed.html" title="“Why is Python Installed on my Computer?” FAQ"
 
776
             >previous</a> |</li>
 
777
        <li><img src="_static/py.png" alt=""
 
778
                 style="vertical-align: middle; margin-top: -1px"/></li>
 
779
        <li><a href="https://www.python.org/">Python</a> &raquo;</li>
 
780
        <li>
 
781
          <span class="version_switcher_placeholder">2.7.12</span>
 
782
          <a href="index.html">Documentation</a> &raquo;
 
783
        </li>
 
784
 
 
785
      </ul>
 
786
    </div>  
 
787
    <div class="footer">
 
788
    &copy; <a href="copyright.html">Copyright</a> 1990-2016, Python Software Foundation.
 
789
    <br />
 
790
    The Python Software Foundation is a non-profit corporation.
 
791
    <a href="https://www.python.org/psf/donations/">Please donate.</a>
 
792
    <br />
 
793
    Last updated on Sep 20, 2016.
 
794
    <a href="bugs.html">Found a bug</a>?
 
795
    <br />
 
796
    Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.3.3.
 
797
    </div>
 
798
 
 
799
  </body>
 
800
</html>
 
 
b'\\ No newline at end of file'