~dkuhlman/python-training-materials/Materials

« back to all changes in this revision

Viewing changes to python-3.5.1-docs-html/library/bisect.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>8.6. bisect — Array bisection algorithm &mdash; Python 3.5.1 documentation</title>
10
 
    
11
 
    <link rel="stylesheet" href="../_static/pydoctheme.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:     '3.5.1',
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 3.5.1 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 3.5.1 documentation" href="../contents.html" />
33
 
    <link rel="up" title="8. Data Types" href="datatypes.html" />
34
 
    <link rel="next" title="8.7. array — Efficient arrays of numeric values" href="array.html" />
35
 
    <link rel="prev" title="8.5. heapq — Heap queue algorithm" href="heapq.html" />
36
 
    <link rel="shortcut icon" type="image/png" href="../_static/py.png" />
37
 
    <script type="text/javascript" src="../_static/copybutton.js"></script>
38
 
    <script type="text/javascript" src="../_static/version_switch.js"></script>
39
 
    
40
 
 
41
 
 
42
 
  </head>
43
 
  <body role="document">  
44
 
    <div class="related" role="navigation" aria-label="related navigation">
45
 
      <h3>Navigation</h3>
46
 
      <ul>
47
 
        <li class="right" style="margin-right: 10px">
48
 
          <a href="../genindex.html" title="General Index"
49
 
             accesskey="I">index</a></li>
50
 
        <li class="right" >
51
 
          <a href="../py-modindex.html" title="Python Module Index"
52
 
             >modules</a> |</li>
53
 
        <li class="right" >
54
 
          <a href="array.html" title="8.7. array — Efficient arrays of numeric values"
55
 
             accesskey="N">next</a> |</li>
56
 
        <li class="right" >
57
 
          <a href="heapq.html" title="8.5. heapq — Heap queue algorithm"
58
 
             accesskey="P">previous</a> |</li>
59
 
        <li><img src="../_static/py.png" alt=""
60
 
                 style="vertical-align: middle; margin-top: -1px"/></li>
61
 
        <li><a href="https://www.python.org/">Python</a> &raquo;</li>
62
 
        <li>
63
 
          <span class="version_switcher_placeholder">3.5.1</span>
64
 
          <a href="../index.html">Documentation </a> &raquo;
65
 
        </li>
66
 
 
67
 
          <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &raquo;</li>
68
 
          <li class="nav-item nav-item-2"><a href="datatypes.html" accesskey="U">8. Data Types</a> &raquo;</li> 
69
 
      </ul>
70
 
    </div>    
71
 
 
72
 
    <div class="document">
73
 
      <div class="documentwrapper">
74
 
        <div class="bodywrapper">
75
 
          <div class="body" role="main">
76
 
            
77
 
  <div class="section" id="module-bisect">
78
 
<span id="bisect-array-bisection-algorithm"></span><h1>8.6. <a class="reference internal" href="#module-bisect" title="bisect: Array bisection algorithms for binary searching."><code class="xref py py-mod docutils literal"><span class="pre">bisect</span></code></a> &#8212; Array bisection algorithm<a class="headerlink" href="#module-bisect" title="Permalink to this headline">¶</a></h1>
79
 
<p><strong>Source code:</strong> <a class="reference external" href="https://hg.python.org/cpython/file/3.5/Lib/bisect.py">Lib/bisect.py</a></p>
80
 
<hr class="docutils" />
81
 
<p>This module provides support for maintaining a list in sorted order without
82
 
having to sort the list after each insertion.  For long lists of items with
83
 
expensive comparison operations, this can be an improvement over the more common
84
 
approach.  The module is called <a class="reference internal" href="#module-bisect" title="bisect: Array bisection algorithms for binary searching."><code class="xref py py-mod docutils literal"><span class="pre">bisect</span></code></a> because it uses a basic bisection
85
 
algorithm to do its work.  The source code may be most useful as a working
86
 
example of the algorithm (the boundary conditions are already right!).</p>
87
 
<p>The following functions are provided:</p>
88
 
<dl class="function">
89
 
<dt id="bisect.bisect_left">
90
 
<code class="descclassname">bisect.</code><code class="descname">bisect_left</code><span class="sig-paren">(</span><em>a</em>, <em>x</em>, <em>lo=0</em>, <em>hi=len(a)</em><span class="sig-paren">)</span><a class="headerlink" href="#bisect.bisect_left" title="Permalink to this definition">¶</a></dt>
91
 
<dd><p>Locate the insertion point for <em>x</em> in <em>a</em> to maintain sorted order.
92
 
The parameters <em>lo</em> and <em>hi</em> may be used to specify a subset of the list
93
 
which should be considered; by default the entire list is used.  If <em>x</em> is
94
 
already present in <em>a</em>, the insertion point will be before (to the left of)
95
 
any existing entries.  The return value is suitable for use as the first
96
 
parameter to <code class="docutils literal"><span class="pre">list.insert()</span></code> assuming that <em>a</em> is already sorted.</p>
97
 
<p>The returned insertion point <em>i</em> partitions the array <em>a</em> into two halves so
98
 
that <code class="docutils literal"><span class="pre">all(val</span> <span class="pre">&lt;</span> <span class="pre">x</span> <span class="pre">for</span> <span class="pre">val</span> <span class="pre">in</span> <span class="pre">a[lo:i])</span></code> for the left side and
99
 
<code class="docutils literal"><span class="pre">all(val</span> <span class="pre">&gt;=</span> <span class="pre">x</span> <span class="pre">for</span> <span class="pre">val</span> <span class="pre">in</span> <span class="pre">a[i:hi])</span></code> for the right side.</p>
100
 
</dd></dl>
101
 
 
102
 
<dl class="function">
103
 
<dt id="bisect.bisect_right">
104
 
<code class="descclassname">bisect.</code><code class="descname">bisect_right</code><span class="sig-paren">(</span><em>a</em>, <em>x</em>, <em>lo=0</em>, <em>hi=len(a)</em><span class="sig-paren">)</span><a class="headerlink" href="#bisect.bisect_right" title="Permalink to this definition">¶</a></dt>
105
 
<dt id="bisect.bisect">
106
 
<code class="descclassname">bisect.</code><code class="descname">bisect</code><span class="sig-paren">(</span><em>a</em>, <em>x</em>, <em>lo=0</em>, <em>hi=len(a)</em><span class="sig-paren">)</span><a class="headerlink" href="#bisect.bisect" title="Permalink to this definition">¶</a></dt>
107
 
<dd><p>Similar to <a class="reference internal" href="#bisect.bisect_left" title="bisect.bisect_left"><code class="xref py py-func docutils literal"><span class="pre">bisect_left()</span></code></a>, but returns an insertion point which comes
108
 
after (to the right of) any existing entries of <em>x</em> in <em>a</em>.</p>
109
 
<p>The returned insertion point <em>i</em> partitions the array <em>a</em> into two halves so
110
 
that <code class="docutils literal"><span class="pre">all(val</span> <span class="pre">&lt;=</span> <span class="pre">x</span> <span class="pre">for</span> <span class="pre">val</span> <span class="pre">in</span> <span class="pre">a[lo:i])</span></code> for the left side and
111
 
<code class="docutils literal"><span class="pre">all(val</span> <span class="pre">&gt;</span> <span class="pre">x</span> <span class="pre">for</span> <span class="pre">val</span> <span class="pre">in</span> <span class="pre">a[i:hi])</span></code> for the right side.</p>
112
 
</dd></dl>
113
 
 
114
 
<dl class="function">
115
 
<dt id="bisect.insort_left">
116
 
<code class="descclassname">bisect.</code><code class="descname">insort_left</code><span class="sig-paren">(</span><em>a</em>, <em>x</em>, <em>lo=0</em>, <em>hi=len(a)</em><span class="sig-paren">)</span><a class="headerlink" href="#bisect.insort_left" title="Permalink to this definition">¶</a></dt>
117
 
<dd><p>Insert <em>x</em> in <em>a</em> in sorted order.  This is equivalent to
118
 
<code class="docutils literal"><span class="pre">a.insert(bisect.bisect_left(a,</span> <span class="pre">x,</span> <span class="pre">lo,</span> <span class="pre">hi),</span> <span class="pre">x)</span></code> assuming that <em>a</em> is
119
 
already sorted.  Keep in mind that the O(log n) search is dominated by
120
 
the slow O(n) insertion step.</p>
121
 
</dd></dl>
122
 
 
123
 
<dl class="function">
124
 
<dt id="bisect.insort_right">
125
 
<code class="descclassname">bisect.</code><code class="descname">insort_right</code><span class="sig-paren">(</span><em>a</em>, <em>x</em>, <em>lo=0</em>, <em>hi=len(a)</em><span class="sig-paren">)</span><a class="headerlink" href="#bisect.insort_right" title="Permalink to this definition">¶</a></dt>
126
 
<dt id="bisect.insort">
127
 
<code class="descclassname">bisect.</code><code class="descname">insort</code><span class="sig-paren">(</span><em>a</em>, <em>x</em>, <em>lo=0</em>, <em>hi=len(a)</em><span class="sig-paren">)</span><a class="headerlink" href="#bisect.insort" title="Permalink to this definition">¶</a></dt>
128
 
<dd><p>Similar to <a class="reference internal" href="#bisect.insort_left" title="bisect.insort_left"><code class="xref py py-func docutils literal"><span class="pre">insort_left()</span></code></a>, but inserting <em>x</em> in <em>a</em> after any existing
129
 
entries of <em>x</em>.</p>
130
 
</dd></dl>
131
 
 
132
 
<div class="admonition seealso">
133
 
<p class="first admonition-title">See also</p>
134
 
<p class="last"><a class="reference external" href="http://code.activestate.com/recipes/577197-sortedcollection/">SortedCollection recipe</a> that uses
135
 
bisect to build a full-featured collection class with straight-forward search
136
 
methods and support for a key-function.  The keys are precomputed to save
137
 
unnecessary calls to the key function during searches.</p>
138
 
</div>
139
 
<div class="section" id="searching-sorted-lists">
140
 
<h2>8.6.1. Searching Sorted Lists<a class="headerlink" href="#searching-sorted-lists" title="Permalink to this headline">¶</a></h2>
141
 
<p>The above <a class="reference internal" href="#module-bisect" title="bisect: Array bisection algorithms for binary searching."><code class="xref py py-func docutils literal"><span class="pre">bisect()</span></code></a> functions are useful for finding insertion points but
142
 
can be tricky or awkward to use for common searching tasks. The following five
143
 
functions show how to transform them into the standard lookups for sorted
144
 
lists:</p>
145
 
<div class="highlight-python3"><div class="highlight"><pre><span class="k">def</span> <span class="nf">index</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">x</span><span class="p">):</span>
146
 
    <span class="s1">&#39;Locate the leftmost value exactly equal to x&#39;</span>
147
 
    <span class="n">i</span> <span class="o">=</span> <span class="n">bisect_left</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">x</span><span class="p">)</span>
148
 
    <span class="k">if</span> <span class="n">i</span> <span class="o">!=</span> <span class="nb">len</span><span class="p">(</span><span class="n">a</span><span class="p">)</span> <span class="ow">and</span> <span class="n">a</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">==</span> <span class="n">x</span><span class="p">:</span>
149
 
        <span class="k">return</span> <span class="n">i</span>
150
 
    <span class="k">raise</span> <span class="ne">ValueError</span>
151
 
 
152
 
<span class="k">def</span> <span class="nf">find_lt</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">x</span><span class="p">):</span>
153
 
    <span class="s1">&#39;Find rightmost value less than x&#39;</span>
154
 
    <span class="n">i</span> <span class="o">=</span> <span class="n">bisect_left</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">x</span><span class="p">)</span>
155
 
    <span class="k">if</span> <span class="n">i</span><span class="p">:</span>
156
 
        <span class="k">return</span> <span class="n">a</span><span class="p">[</span><span class="n">i</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
157
 
    <span class="k">raise</span> <span class="ne">ValueError</span>
158
 
 
159
 
<span class="k">def</span> <span class="nf">find_le</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">x</span><span class="p">):</span>
160
 
    <span class="s1">&#39;Find rightmost value less than or equal to x&#39;</span>
161
 
    <span class="n">i</span> <span class="o">=</span> <span class="n">bisect_right</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">x</span><span class="p">)</span>
162
 
    <span class="k">if</span> <span class="n">i</span><span class="p">:</span>
163
 
        <span class="k">return</span> <span class="n">a</span><span class="p">[</span><span class="n">i</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
164
 
    <span class="k">raise</span> <span class="ne">ValueError</span>
165
 
 
166
 
<span class="k">def</span> <span class="nf">find_gt</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">x</span><span class="p">):</span>
167
 
    <span class="s1">&#39;Find leftmost value greater than x&#39;</span>
168
 
    <span class="n">i</span> <span class="o">=</span> <span class="n">bisect_right</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">x</span><span class="p">)</span>
169
 
    <span class="k">if</span> <span class="n">i</span> <span class="o">!=</span> <span class="nb">len</span><span class="p">(</span><span class="n">a</span><span class="p">):</span>
170
 
        <span class="k">return</span> <span class="n">a</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>
171
 
    <span class="k">raise</span> <span class="ne">ValueError</span>
172
 
 
173
 
<span class="k">def</span> <span class="nf">find_ge</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">x</span><span class="p">):</span>
174
 
    <span class="s1">&#39;Find leftmost item greater than or equal to x&#39;</span>
175
 
    <span class="n">i</span> <span class="o">=</span> <span class="n">bisect_left</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">x</span><span class="p">)</span>
176
 
    <span class="k">if</span> <span class="n">i</span> <span class="o">!=</span> <span class="nb">len</span><span class="p">(</span><span class="n">a</span><span class="p">):</span>
177
 
        <span class="k">return</span> <span class="n">a</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>
178
 
    <span class="k">raise</span> <span class="ne">ValueError</span>
179
 
</pre></div>
180
 
</div>
181
 
</div>
182
 
<div class="section" id="other-examples">
183
 
<h2>8.6.2. Other Examples<a class="headerlink" href="#other-examples" title="Permalink to this headline">¶</a></h2>
184
 
<p id="bisect-example">The <a class="reference internal" href="#module-bisect" title="bisect: Array bisection algorithms for binary searching."><code class="xref py py-func docutils literal"><span class="pre">bisect()</span></code></a> function can be useful for numeric table lookups. This
185
 
example uses <a class="reference internal" href="#module-bisect" title="bisect: Array bisection algorithms for binary searching."><code class="xref py py-func docutils literal"><span class="pre">bisect()</span></code></a> to look up a letter grade for an exam score (say)
186
 
based on a set of ordered numeric breakpoints: 90 and up is an &#8216;A&#8217;, 80 to 89 is
187
 
a &#8216;B&#8217;, and so on:</p>
188
 
<div class="highlight-python3"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="k">def</span> <span class="nf">grade</span><span class="p">(</span><span class="n">score</span><span class="p">,</span> <span class="n">breakpoints</span><span class="o">=</span><span class="p">[</span><span class="mi">60</span><span class="p">,</span> <span class="mi">70</span><span class="p">,</span> <span class="mi">80</span><span class="p">,</span> <span class="mi">90</span><span class="p">],</span> <span class="n">grades</span><span class="o">=</span><span class="s1">&#39;FDCBA&#39;</span><span class="p">):</span>
189
 
<span class="gp">... </span>    <span class="n">i</span> <span class="o">=</span> <span class="n">bisect</span><span class="p">(</span><span class="n">breakpoints</span><span class="p">,</span> <span class="n">score</span><span class="p">)</span>
190
 
<span class="gp">... </span>    <span class="k">return</span> <span class="n">grades</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>
191
 
<span class="gp">...</span>
192
 
<span class="gp">&gt;&gt;&gt; </span><span class="p">[</span><span class="n">grade</span><span class="p">(</span><span class="n">score</span><span class="p">)</span> <span class="k">for</span> <span class="n">score</span> <span class="ow">in</span> <span class="p">[</span><span class="mi">33</span><span class="p">,</span> <span class="mi">99</span><span class="p">,</span> <span class="mi">77</span><span class="p">,</span> <span class="mi">70</span><span class="p">,</span> <span class="mi">89</span><span class="p">,</span> <span class="mi">90</span><span class="p">,</span> <span class="mi">100</span><span class="p">]]</span>
193
 
<span class="go">[&#39;F&#39;, &#39;A&#39;, &#39;C&#39;, &#39;C&#39;, &#39;B&#39;, &#39;A&#39;, &#39;A&#39;]</span>
194
 
</pre></div>
195
 
</div>
196
 
<p>Unlike the <a class="reference internal" href="functions.html#sorted" title="sorted"><code class="xref py py-func docutils literal"><span class="pre">sorted()</span></code></a> function, it does not make sense for the <a class="reference internal" href="#module-bisect" title="bisect: Array bisection algorithms for binary searching."><code class="xref py py-func docutils literal"><span class="pre">bisect()</span></code></a>
197
 
functions to have <em>key</em> or <em>reversed</em> arguments because that would lead to an
198
 
inefficient design (successive calls to bisect functions would not &#8220;remember&#8221;
199
 
all of the previous key lookups).</p>
200
 
<p>Instead, it is better to search a list of precomputed keys to find the index
201
 
of the record in question:</p>
202
 
<div class="highlight-python3"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">data</span> <span class="o">=</span> <span class="p">[(</span><span class="s1">&#39;red&#39;</span><span class="p">,</span> <span class="mi">5</span><span class="p">),</span> <span class="p">(</span><span class="s1">&#39;blue&#39;</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="s1">&#39;yellow&#39;</span><span class="p">,</span> <span class="mi">8</span><span class="p">),</span> <span class="p">(</span><span class="s1">&#39;black&#39;</span><span class="p">,</span> <span class="mi">0</span><span class="p">)]</span>
203
 
<span class="gp">&gt;&gt;&gt; </span><span class="n">data</span><span class="o">.</span><span class="n">sort</span><span class="p">(</span><span class="n">key</span><span class="o">=</span><span class="k">lambda</span> <span class="n">r</span><span class="p">:</span> <span class="n">r</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
204
 
<span class="gp">&gt;&gt;&gt; </span><span class="n">keys</span> <span class="o">=</span> <span class="p">[</span><span class="n">r</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="k">for</span> <span class="n">r</span> <span class="ow">in</span> <span class="n">data</span><span class="p">]</span>         <span class="c1"># precomputed list of keys</span>
205
 
<span class="gp">&gt;&gt;&gt; </span><span class="n">data</span><span class="p">[</span><span class="n">bisect_left</span><span class="p">(</span><span class="n">keys</span><span class="p">,</span> <span class="mi">0</span><span class="p">)]</span>
206
 
<span class="go">(&#39;black&#39;, 0)</span>
207
 
<span class="gp">&gt;&gt;&gt; </span><span class="n">data</span><span class="p">[</span><span class="n">bisect_left</span><span class="p">(</span><span class="n">keys</span><span class="p">,</span> <span class="mi">1</span><span class="p">)]</span>
208
 
<span class="go">(&#39;blue&#39;, 1)</span>
209
 
<span class="gp">&gt;&gt;&gt; </span><span class="n">data</span><span class="p">[</span><span class="n">bisect_left</span><span class="p">(</span><span class="n">keys</span><span class="p">,</span> <span class="mi">5</span><span class="p">)]</span>
210
 
<span class="go">(&#39;red&#39;, 5)</span>
211
 
<span class="gp">&gt;&gt;&gt; </span><span class="n">data</span><span class="p">[</span><span class="n">bisect_left</span><span class="p">(</span><span class="n">keys</span><span class="p">,</span> <span class="mi">8</span><span class="p">)]</span>
212
 
<span class="go">(&#39;yellow&#39;, 8)</span>
213
 
</pre></div>
214
 
</div>
215
 
</div>
216
 
</div>
217
 
 
218
 
 
219
 
          </div>
220
 
        </div>
221
 
      </div>
222
 
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
223
 
        <div class="sphinxsidebarwrapper">
224
 
  <h3><a href="../contents.html">Table Of Contents</a></h3>
225
 
  <ul>
226
 
<li><a class="reference internal" href="#">8.6. <code class="docutils literal"><span class="pre">bisect</span></code> &#8212; Array bisection algorithm</a><ul>
227
 
<li><a class="reference internal" href="#searching-sorted-lists">8.6.1. Searching Sorted Lists</a></li>
228
 
<li><a class="reference internal" href="#other-examples">8.6.2. Other Examples</a></li>
229
 
</ul>
230
 
</li>
231
 
</ul>
232
 
 
233
 
  <h4>Previous topic</h4>
234
 
  <p class="topless"><a href="heapq.html"
235
 
                        title="previous chapter">8.5. <code class="docutils literal"><span class="pre">heapq</span></code> &#8212; Heap queue algorithm</a></p>
236
 
  <h4>Next topic</h4>
237
 
  <p class="topless"><a href="array.html"
238
 
                        title="next chapter">8.7. <code class="docutils literal"><span class="pre">array</span></code> &#8212; Efficient arrays of numeric values</a></p>
239
 
<h3>This Page</h3>
240
 
<ul class="this-page-menu">
241
 
  <li><a href="../bugs.html">Report a Bug</a></li>
242
 
  <li><a href="../_sources/library/bisect.txt"
243
 
         rel="nofollow">Show Source</a></li>
244
 
</ul>
245
 
 
246
 
<div id="searchbox" style="display: none" role="search">
247
 
  <h3>Quick search</h3>
248
 
    <form class="search" action="../search.html" method="get">
249
 
      <input type="text" name="q" />
250
 
      <input type="submit" value="Go" />
251
 
      <input type="hidden" name="check_keywords" value="yes" />
252
 
      <input type="hidden" name="area" value="default" />
253
 
    </form>
254
 
    <p class="searchtip" style="font-size: 90%">
255
 
    Enter search terms or a module, class or function name.
256
 
    </p>
257
 
</div>
258
 
<script type="text/javascript">$('#searchbox').show(0);</script>
259
 
        </div>
260
 
      </div>
261
 
      <div class="clearer"></div>
262
 
    </div>  
263
 
    <div class="related" role="navigation" aria-label="related navigation">
264
 
      <h3>Navigation</h3>
265
 
      <ul>
266
 
        <li class="right" style="margin-right: 10px">
267
 
          <a href="../genindex.html" title="General Index"
268
 
             >index</a></li>
269
 
        <li class="right" >
270
 
          <a href="../py-modindex.html" title="Python Module Index"
271
 
             >modules</a> |</li>
272
 
        <li class="right" >
273
 
          <a href="array.html" title="8.7. array — Efficient arrays of numeric values"
274
 
             >next</a> |</li>
275
 
        <li class="right" >
276
 
          <a href="heapq.html" title="8.5. heapq — Heap queue algorithm"
277
 
             >previous</a> |</li>
278
 
        <li><img src="../_static/py.png" alt=""
279
 
                 style="vertical-align: middle; margin-top: -1px"/></li>
280
 
        <li><a href="https://www.python.org/">Python</a> &raquo;</li>
281
 
        <li>
282
 
          <span class="version_switcher_placeholder">3.5.1</span>
283
 
          <a href="../index.html">Documentation </a> &raquo;
284
 
        </li>
285
 
 
286
 
          <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &raquo;</li>
287
 
          <li class="nav-item nav-item-2"><a href="datatypes.html" >8. Data Types</a> &raquo;</li> 
288
 
      </ul>
289
 
    </div>  
290
 
    <div class="footer">
291
 
    &copy; <a href="../copyright.html">Copyright</a> 1990-2016, Python Software Foundation.
292
 
    <br />
293
 
    The Python Software Foundation is a non-profit corporation.
294
 
    <a href="https://www.python.org/psf/donations/">Please donate.</a>
295
 
    <br />
296
 
    Last updated on Jan 22, 2016.
297
 
    <a href="../bugs.html">Found a bug</a>?
298
 
    <br />
299
 
    Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.3.3.
300
 
    </div>
301
 
 
302
 
  </body>
303
 
</html>
 
 
b'\\ No newline at end of file'