~dkuhlman/python-training-materials/Materials

« back to all changes in this revision

Viewing changes to python-2.7.11-docs-html/library/types.html

  • Committer: Dave Kuhlman
  • Date: 2016-02-11 21:17:09 UTC
  • Revision ID: dkuhlman@davekuhlman.org-20160211211709-03yaen3cjempbi2m
Updated Python 2.7 docs; added Python 3.5 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.15. types — Names for built-in types &mdash; Python 2.7.11 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.11',
 
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.11 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.11 documentation" href="../contents.html" />
 
33
    <link rel="up" title="8. Data Types" href="datatypes.html" />
 
34
    <link rel="next" title="8.16. new — Creation of runtime internal objects" href="new.html" />
 
35
    <link rel="prev" title="8.12. UserDict — Class wrapper for dictionary objects" href="userdict.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="new.html" title="8.16. new — Creation of runtime internal objects"
 
55
             accesskey="N">next</a> |</li>
 
56
        <li class="right" >
 
57
          <a href="userdict.html" title="8.12. UserDict — Class wrapper for dictionary objects"
 
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">2.7.11</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-types">
 
78
<span id="types-names-for-built-in-types"></span><h1>8.15. <a class="reference internal" href="#module-types" title="types: Names for built-in types."><code class="xref py py-mod docutils literal"><span class="pre">types</span></code></a> &#8212; Names for built-in types<a class="headerlink" href="#module-types" title="Permalink to this headline">¶</a></h1>
 
79
<p><strong>Source code:</strong> <a class="reference external" href="https://hg.python.org/cpython/file/2.7/Lib/types.py">Lib/types.py</a></p>
 
80
<hr class="docutils" />
 
81
<p>This module defines names for some object types that are used by the standard
 
82
Python interpreter, but not for the types defined by various extension modules.
 
83
Also, it does not include some of the types that arise during processing such as
 
84
the <code class="docutils literal"><span class="pre">listiterator</span></code> type. It is safe to use <code class="docutils literal"><span class="pre">from</span> <span class="pre">types</span> <span class="pre">import</span> <span class="pre">*</span></code> &#8212; the
 
85
module does not export any names besides the ones listed here. New names
 
86
exported by future versions of this module will all end in <code class="docutils literal"><span class="pre">Type</span></code>.</p>
 
87
<p>Typical use is for functions that do different things depending on their
 
88
argument types, like the following:</p>
 
89
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">types</span> <span class="kn">import</span> <span class="o">*</span>
 
90
<span class="k">def</span> <span class="nf">delete</span><span class="p">(</span><span class="n">mylist</span><span class="p">,</span> <span class="n">item</span><span class="p">):</span>
 
91
    <span class="k">if</span> <span class="nb">type</span><span class="p">(</span><span class="n">item</span><span class="p">)</span> <span class="ow">is</span> <span class="n">IntType</span><span class="p">:</span>
 
92
       <span class="k">del</span> <span class="n">mylist</span><span class="p">[</span><span class="n">item</span><span class="p">]</span>
 
93
    <span class="k">else</span><span class="p">:</span>
 
94
       <span class="n">mylist</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
 
95
</pre></div>
 
96
</div>
 
97
<p>Starting in Python 2.2, built-in factory functions such as <a class="reference internal" href="functions.html#int" title="int"><code class="xref py py-func docutils literal"><span class="pre">int()</span></code></a> and
 
98
<a class="reference internal" href="functions.html#str" title="str"><code class="xref py py-func docutils literal"><span class="pre">str()</span></code></a> are also names for the corresponding types.  This is now the
 
99
preferred way to access the type instead of using the <a class="reference internal" href="#module-types" title="types: Names for built-in types."><code class="xref py py-mod docutils literal"><span class="pre">types</span></code></a> module.
 
100
Accordingly, the example above should be written as follows:</p>
 
101
<div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">delete</span><span class="p">(</span><span class="n">mylist</span><span class="p">,</span> <span class="n">item</span><span class="p">):</span>
 
102
    <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="nb">int</span><span class="p">):</span>
 
103
       <span class="k">del</span> <span class="n">mylist</span><span class="p">[</span><span class="n">item</span><span class="p">]</span>
 
104
    <span class="k">else</span><span class="p">:</span>
 
105
       <span class="n">mylist</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
 
106
</pre></div>
 
107
</div>
 
108
<p>The module defines the following names:</p>
 
109
<dl class="data">
 
110
<dt id="types.NoneType">
 
111
<code class="descclassname">types.</code><code class="descname">NoneType</code><a class="headerlink" href="#types.NoneType" title="Permalink to this definition">¶</a></dt>
 
112
<dd><p>The type of <code class="docutils literal"><span class="pre">None</span></code>.</p>
 
113
</dd></dl>
 
114
 
 
115
<dl class="data">
 
116
<dt id="types.TypeType">
 
117
<code class="descclassname">types.</code><code class="descname">TypeType</code><a class="headerlink" href="#types.TypeType" title="Permalink to this definition">¶</a></dt>
 
118
<dd><p id="index-0">The type of type objects (such as returned by <a class="reference internal" href="functions.html#type" title="type"><code class="xref py py-func docutils literal"><span class="pre">type()</span></code></a>); alias of the
 
119
built-in <a class="reference internal" href="functions.html#type" title="type"><code class="xref py py-class docutils literal"><span class="pre">type</span></code></a>.</p>
 
120
</dd></dl>
 
121
 
 
122
<dl class="data">
 
123
<dt id="types.BooleanType">
 
124
<code class="descclassname">types.</code><code class="descname">BooleanType</code><a class="headerlink" href="#types.BooleanType" title="Permalink to this definition">¶</a></dt>
 
125
<dd><p>The type of the <a class="reference internal" href="functions.html#bool" title="bool"><code class="xref py py-class docutils literal"><span class="pre">bool</span></code></a> values <code class="docutils literal"><span class="pre">True</span></code> and <code class="docutils literal"><span class="pre">False</span></code>; alias of the
 
126
built-in <a class="reference internal" href="functions.html#bool" title="bool"><code class="xref py py-class docutils literal"><span class="pre">bool</span></code></a>.</p>
 
127
<div class="versionadded">
 
128
<p><span class="versionmodified">New in version 2.3.</span></p>
 
129
</div>
 
130
</dd></dl>
 
131
 
 
132
<dl class="data">
 
133
<dt id="types.IntType">
 
134
<code class="descclassname">types.</code><code class="descname">IntType</code><a class="headerlink" href="#types.IntType" title="Permalink to this definition">¶</a></dt>
 
135
<dd><p>The type of integers (e.g. <code class="docutils literal"><span class="pre">1</span></code>); alias of the built-in <a class="reference internal" href="functions.html#int" title="int"><code class="xref py py-class docutils literal"><span class="pre">int</span></code></a>.</p>
 
136
</dd></dl>
 
137
 
 
138
<dl class="data">
 
139
<dt id="types.LongType">
 
140
<code class="descclassname">types.</code><code class="descname">LongType</code><a class="headerlink" href="#types.LongType" title="Permalink to this definition">¶</a></dt>
 
141
<dd><p>The type of long integers (e.g. <code class="docutils literal"><span class="pre">1L</span></code>); alias of the built-in <a class="reference internal" href="functions.html#long" title="long"><code class="xref py py-class docutils literal"><span class="pre">long</span></code></a>.</p>
 
142
</dd></dl>
 
143
 
 
144
<dl class="data">
 
145
<dt id="types.FloatType">
 
146
<code class="descclassname">types.</code><code class="descname">FloatType</code><a class="headerlink" href="#types.FloatType" title="Permalink to this definition">¶</a></dt>
 
147
<dd><p>The type of floating point numbers (e.g. <code class="docutils literal"><span class="pre">1.0</span></code>); alias of the built-in
 
148
<a class="reference internal" href="functions.html#float" title="float"><code class="xref py py-class docutils literal"><span class="pre">float</span></code></a>.</p>
 
149
</dd></dl>
 
150
 
 
151
<dl class="data">
 
152
<dt id="types.ComplexType">
 
153
<code class="descclassname">types.</code><code class="descname">ComplexType</code><a class="headerlink" href="#types.ComplexType" title="Permalink to this definition">¶</a></dt>
 
154
<dd><p>The type of complex numbers (e.g. <code class="docutils literal"><span class="pre">1.0j</span></code>).  This is not defined if Python was
 
155
built without complex number support.</p>
 
156
</dd></dl>
 
157
 
 
158
<dl class="data">
 
159
<dt id="types.StringType">
 
160
<code class="descclassname">types.</code><code class="descname">StringType</code><a class="headerlink" href="#types.StringType" title="Permalink to this definition">¶</a></dt>
 
161
<dd><p>The type of character strings (e.g. <code class="docutils literal"><span class="pre">'Spam'</span></code>); alias of the built-in
 
162
<a class="reference internal" href="functions.html#str" title="str"><code class="xref py py-class docutils literal"><span class="pre">str</span></code></a>.</p>
 
163
</dd></dl>
 
164
 
 
165
<dl class="data">
 
166
<dt id="types.UnicodeType">
 
167
<code class="descclassname">types.</code><code class="descname">UnicodeType</code><a class="headerlink" href="#types.UnicodeType" title="Permalink to this definition">¶</a></dt>
 
168
<dd><p>The type of Unicode character strings (e.g. <code class="docutils literal"><span class="pre">u'Spam'</span></code>).  This is not defined
 
169
if Python was built without Unicode support.  It&#8217;s an alias of the built-in
 
170
<a class="reference internal" href="functions.html#unicode" title="unicode"><code class="xref py py-class docutils literal"><span class="pre">unicode</span></code></a>.</p>
 
171
</dd></dl>
 
172
 
 
173
<dl class="data">
 
174
<dt id="types.TupleType">
 
175
<code class="descclassname">types.</code><code class="descname">TupleType</code><a class="headerlink" href="#types.TupleType" title="Permalink to this definition">¶</a></dt>
 
176
<dd><p>The type of tuples (e.g. <code class="docutils literal"><span class="pre">(1,</span> <span class="pre">2,</span> <span class="pre">3,</span> <span class="pre">'Spam')</span></code>); alias of the built-in
 
177
<a class="reference internal" href="functions.html#tuple" title="tuple"><code class="xref py py-class docutils literal"><span class="pre">tuple</span></code></a>.</p>
 
178
</dd></dl>
 
179
 
 
180
<dl class="data">
 
181
<dt id="types.ListType">
 
182
<code class="descclassname">types.</code><code class="descname">ListType</code><a class="headerlink" href="#types.ListType" title="Permalink to this definition">¶</a></dt>
 
183
<dd><p>The type of lists (e.g. <code class="docutils literal"><span class="pre">[0,</span> <span class="pre">1,</span> <span class="pre">2,</span> <span class="pre">3]</span></code>); alias of the built-in
 
184
<a class="reference internal" href="functions.html#list" title="list"><code class="xref py py-class docutils literal"><span class="pre">list</span></code></a>.</p>
 
185
</dd></dl>
 
186
 
 
187
<dl class="data">
 
188
<dt id="types.DictType">
 
189
<code class="descclassname">types.</code><code class="descname">DictType</code><a class="headerlink" href="#types.DictType" title="Permalink to this definition">¶</a></dt>
 
190
<dd><p>The type of dictionaries (e.g. <code class="docutils literal"><span class="pre">{'Bacon':</span> <span class="pre">1,</span> <span class="pre">'Ham':</span> <span class="pre">0}</span></code>); alias of the
 
191
built-in <a class="reference internal" href="stdtypes.html#dict" title="dict"><code class="xref py py-class docutils literal"><span class="pre">dict</span></code></a>.</p>
 
192
</dd></dl>
 
193
 
 
194
<dl class="data">
 
195
<dt id="types.DictionaryType">
 
196
<code class="descclassname">types.</code><code class="descname">DictionaryType</code><a class="headerlink" href="#types.DictionaryType" title="Permalink to this definition">¶</a></dt>
 
197
<dd><p>An alternate name for <code class="docutils literal"><span class="pre">DictType</span></code>.</p>
 
198
</dd></dl>
 
199
 
 
200
<dl class="data">
 
201
<dt id="types.FunctionType">
 
202
<code class="descclassname">types.</code><code class="descname">FunctionType</code><a class="headerlink" href="#types.FunctionType" title="Permalink to this definition">¶</a></dt>
 
203
<dt id="types.LambdaType">
 
204
<code class="descclassname">types.</code><code class="descname">LambdaType</code><a class="headerlink" href="#types.LambdaType" title="Permalink to this definition">¶</a></dt>
 
205
<dd><p>The type of user-defined functions and functions created by <a class="reference internal" href="../reference/expressions.html#lambda"><code class="xref std std-keyword docutils literal"><span class="pre">lambda</span></code></a>
 
206
expressions.</p>
 
207
</dd></dl>
 
208
 
 
209
<dl class="data">
 
210
<dt id="types.GeneratorType">
 
211
<code class="descclassname">types.</code><code class="descname">GeneratorType</code><a class="headerlink" href="#types.GeneratorType" title="Permalink to this definition">¶</a></dt>
 
212
<dd><p>The type of <a class="reference internal" href="../glossary.html#term-generator"><span class="xref std std-term">generator</span></a>-iterator objects, produced by calling a
 
213
generator function.</p>
 
214
<div class="versionadded">
 
215
<p><span class="versionmodified">New in version 2.2.</span></p>
 
216
</div>
 
217
</dd></dl>
 
218
 
 
219
<dl class="data">
 
220
<dt id="types.CodeType">
 
221
<code class="descclassname">types.</code><code class="descname">CodeType</code><a class="headerlink" href="#types.CodeType" title="Permalink to this definition">¶</a></dt>
 
222
<dd><p id="index-1">The type for code objects such as returned by <a class="reference internal" href="functions.html#compile" title="compile"><code class="xref py py-func docutils literal"><span class="pre">compile()</span></code></a>.</p>
 
223
</dd></dl>
 
224
 
 
225
<dl class="data">
 
226
<dt id="types.ClassType">
 
227
<code class="descclassname">types.</code><code class="descname">ClassType</code><a class="headerlink" href="#types.ClassType" title="Permalink to this definition">¶</a></dt>
 
228
<dd><p>The type of user-defined old-style classes.</p>
 
229
</dd></dl>
 
230
 
 
231
<dl class="data">
 
232
<dt id="types.InstanceType">
 
233
<code class="descclassname">types.</code><code class="descname">InstanceType</code><a class="headerlink" href="#types.InstanceType" title="Permalink to this definition">¶</a></dt>
 
234
<dd><p>The type of instances of user-defined classes.</p>
 
235
</dd></dl>
 
236
 
 
237
<dl class="data">
 
238
<dt id="types.MethodType">
 
239
<code class="descclassname">types.</code><code class="descname">MethodType</code><a class="headerlink" href="#types.MethodType" title="Permalink to this definition">¶</a></dt>
 
240
<dd><p>The type of methods of user-defined class instances.</p>
 
241
</dd></dl>
 
242
 
 
243
<dl class="data">
 
244
<dt id="types.UnboundMethodType">
 
245
<code class="descclassname">types.</code><code class="descname">UnboundMethodType</code><a class="headerlink" href="#types.UnboundMethodType" title="Permalink to this definition">¶</a></dt>
 
246
<dd><p>An alternate name for <code class="docutils literal"><span class="pre">MethodType</span></code>.</p>
 
247
</dd></dl>
 
248
 
 
249
<dl class="data">
 
250
<dt id="types.BuiltinFunctionType">
 
251
<code class="descclassname">types.</code><code class="descname">BuiltinFunctionType</code><a class="headerlink" href="#types.BuiltinFunctionType" title="Permalink to this definition">¶</a></dt>
 
252
<dt id="types.BuiltinMethodType">
 
253
<code class="descclassname">types.</code><code class="descname">BuiltinMethodType</code><a class="headerlink" href="#types.BuiltinMethodType" title="Permalink to this definition">¶</a></dt>
 
254
<dd><p>The type of built-in functions like <a class="reference internal" href="functions.html#len" title="len"><code class="xref py py-func docutils literal"><span class="pre">len()</span></code></a> or <a class="reference internal" href="sys.html#sys.exit" title="sys.exit"><code class="xref py py-func docutils literal"><span class="pre">sys.exit()</span></code></a>, and
 
255
methods of built-in classes.  (Here, the term &#8220;built-in&#8221; means &#8220;written in
 
256
C&#8221;.)</p>
 
257
</dd></dl>
 
258
 
 
259
<dl class="data">
 
260
<dt id="types.ModuleType">
 
261
<code class="descclassname">types.</code><code class="descname">ModuleType</code><a class="headerlink" href="#types.ModuleType" title="Permalink to this definition">¶</a></dt>
 
262
<dd><p>The type of modules.</p>
 
263
</dd></dl>
 
264
 
 
265
<dl class="data">
 
266
<dt id="types.FileType">
 
267
<code class="descclassname">types.</code><code class="descname">FileType</code><a class="headerlink" href="#types.FileType" title="Permalink to this definition">¶</a></dt>
 
268
<dd><p>The type of open file objects such as <code class="docutils literal"><span class="pre">sys.stdout</span></code>; alias of the built-in
 
269
<a class="reference internal" href="functions.html#file" title="file"><code class="xref py py-class docutils literal"><span class="pre">file</span></code></a>.</p>
 
270
</dd></dl>
 
271
 
 
272
<dl class="data">
 
273
<dt id="types.XRangeType">
 
274
<code class="descclassname">types.</code><code class="descname">XRangeType</code><a class="headerlink" href="#types.XRangeType" title="Permalink to this definition">¶</a></dt>
 
275
<dd><p id="index-2">The type of range objects returned by <a class="reference internal" href="functions.html#xrange" title="xrange"><code class="xref py py-func docutils literal"><span class="pre">xrange()</span></code></a>; alias of the built-in
 
276
<a class="reference internal" href="functions.html#xrange" title="xrange"><code class="xref py py-class docutils literal"><span class="pre">xrange</span></code></a>.</p>
 
277
</dd></dl>
 
278
 
 
279
<dl class="data">
 
280
<dt id="types.SliceType">
 
281
<code class="descclassname">types.</code><code class="descname">SliceType</code><a class="headerlink" href="#types.SliceType" title="Permalink to this definition">¶</a></dt>
 
282
<dd><p id="index-3">The type of objects returned by <a class="reference internal" href="functions.html#slice" title="slice"><code class="xref py py-func docutils literal"><span class="pre">slice()</span></code></a>; alias of the built-in
 
283
<a class="reference internal" href="functions.html#slice" title="slice"><code class="xref py py-class docutils literal"><span class="pre">slice</span></code></a>.</p>
 
284
</dd></dl>
 
285
 
 
286
<dl class="data">
 
287
<dt id="types.EllipsisType">
 
288
<code class="descclassname">types.</code><code class="descname">EllipsisType</code><a class="headerlink" href="#types.EllipsisType" title="Permalink to this definition">¶</a></dt>
 
289
<dd><p>The type of <code class="docutils literal"><span class="pre">Ellipsis</span></code>.</p>
 
290
</dd></dl>
 
291
 
 
292
<dl class="data">
 
293
<dt id="types.TracebackType">
 
294
<code class="descclassname">types.</code><code class="descname">TracebackType</code><a class="headerlink" href="#types.TracebackType" title="Permalink to this definition">¶</a></dt>
 
295
<dd><p>The type of traceback objects such as found in <code class="docutils literal"><span class="pre">sys.exc_traceback</span></code>.</p>
 
296
</dd></dl>
 
297
 
 
298
<dl class="data">
 
299
<dt id="types.FrameType">
 
300
<code class="descclassname">types.</code><code class="descname">FrameType</code><a class="headerlink" href="#types.FrameType" title="Permalink to this definition">¶</a></dt>
 
301
<dd><p>The type of frame objects such as found in <code class="docutils literal"><span class="pre">tb.tb_frame</span></code> if <code class="docutils literal"><span class="pre">tb</span></code> is a
 
302
traceback object.</p>
 
303
</dd></dl>
 
304
 
 
305
<dl class="data">
 
306
<dt id="types.BufferType">
 
307
<code class="descclassname">types.</code><code class="descname">BufferType</code><a class="headerlink" href="#types.BufferType" title="Permalink to this definition">¶</a></dt>
 
308
<dd><p id="index-4">The type of buffer objects created by the <a class="reference internal" href="functions.html#buffer" title="buffer"><code class="xref py py-func docutils literal"><span class="pre">buffer()</span></code></a> function.</p>
 
309
</dd></dl>
 
310
 
 
311
<dl class="data">
 
312
<dt id="types.DictProxyType">
 
313
<code class="descclassname">types.</code><code class="descname">DictProxyType</code><a class="headerlink" href="#types.DictProxyType" title="Permalink to this definition">¶</a></dt>
 
314
<dd><p>The type of dict proxies, such as <code class="docutils literal"><span class="pre">TypeType.__dict__</span></code>.</p>
 
315
</dd></dl>
 
316
 
 
317
<dl class="data">
 
318
<dt id="types.NotImplementedType">
 
319
<code class="descclassname">types.</code><code class="descname">NotImplementedType</code><a class="headerlink" href="#types.NotImplementedType" title="Permalink to this definition">¶</a></dt>
 
320
<dd><p>The type of <code class="docutils literal"><span class="pre">NotImplemented</span></code></p>
 
321
</dd></dl>
 
322
 
 
323
<dl class="data">
 
324
<dt id="types.GetSetDescriptorType">
 
325
<code class="descclassname">types.</code><code class="descname">GetSetDescriptorType</code><a class="headerlink" href="#types.GetSetDescriptorType" title="Permalink to this definition">¶</a></dt>
 
326
<dd><p>The type of objects defined in extension modules with <code class="docutils literal"><span class="pre">PyGetSetDef</span></code>, such
 
327
as <code class="docutils literal"><span class="pre">FrameType.f_locals</span></code> or <code class="docutils literal"><span class="pre">array.array.typecode</span></code>.  This type is used as
 
328
descriptor for object attributes; it has the same purpose as the
 
329
<a class="reference internal" href="functions.html#property" title="property"><code class="xref py py-class docutils literal"><span class="pre">property</span></code></a> type, but for classes defined in extension modules.</p>
 
330
<div class="versionadded">
 
331
<p><span class="versionmodified">New in version 2.5.</span></p>
 
332
</div>
 
333
</dd></dl>
 
334
 
 
335
<dl class="data">
 
336
<dt id="types.MemberDescriptorType">
 
337
<code class="descclassname">types.</code><code class="descname">MemberDescriptorType</code><a class="headerlink" href="#types.MemberDescriptorType" title="Permalink to this definition">¶</a></dt>
 
338
<dd><p>The type of objects defined in extension modules with <code class="docutils literal"><span class="pre">PyMemberDef</span></code>, such
 
339
as <code class="docutils literal"><span class="pre">datetime.timedelta.days</span></code>.  This type is used as descriptor for simple C
 
340
data members which use standard conversion functions; it has the same purpose
 
341
as the <a class="reference internal" href="functions.html#property" title="property"><code class="xref py py-class docutils literal"><span class="pre">property</span></code></a> type, but for classes defined in extension modules.</p>
 
342
<div class="impl-detail compound">
 
343
<p><strong>CPython implementation detail:</strong> In other implementations of Python, this type may be identical to
 
344
<code class="docutils literal"><span class="pre">GetSetDescriptorType</span></code>.</p>
 
345
</div>
 
346
<div class="versionadded">
 
347
<p><span class="versionmodified">New in version 2.5.</span></p>
 
348
</div>
 
349
</dd></dl>
 
350
 
 
351
<dl class="data">
 
352
<dt id="types.StringTypes">
 
353
<code class="descclassname">types.</code><code class="descname">StringTypes</code><a class="headerlink" href="#types.StringTypes" title="Permalink to this definition">¶</a></dt>
 
354
<dd><p>A sequence containing <code class="docutils literal"><span class="pre">StringType</span></code> and <code class="docutils literal"><span class="pre">UnicodeType</span></code> used to facilitate
 
355
easier checking for any string object.  Using this is more portable than using a
 
356
sequence of the two string types constructed elsewhere since it only contains
 
357
<code class="docutils literal"><span class="pre">UnicodeType</span></code> if it has been built in the running version of Python.  For
 
358
example: <code class="docutils literal"><span class="pre">isinstance(s,</span> <span class="pre">types.StringTypes)</span></code>.</p>
 
359
<div class="versionadded">
 
360
<p><span class="versionmodified">New in version 2.2.</span></p>
 
361
</div>
 
362
</dd></dl>
 
363
 
 
364
</div>
 
365
 
 
366
 
 
367
          </div>
 
368
        </div>
 
369
      </div>
 
370
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
 
371
        <div class="sphinxsidebarwrapper">
 
372
  <h4>Previous topic</h4>
 
373
  <p class="topless"><a href="userdict.html"
 
374
                        title="previous chapter">8.12. <code class="docutils literal"><span class="pre">UserDict</span></code> &#8212; Class wrapper for dictionary objects</a></p>
 
375
  <h4>Next topic</h4>
 
376
  <p class="topless"><a href="new.html"
 
377
                        title="next chapter">8.16. <code class="docutils literal"><span class="pre">new</span></code> &#8212; Creation of runtime internal objects</a></p>
 
378
<h3>This Page</h3>
 
379
<ul class="this-page-menu">
 
380
  <li><a href="../bugs.html">Report a Bug</a></li>
 
381
  <li><a href="../_sources/library/types.txt"
 
382
         rel="nofollow">Show Source</a></li>
 
383
</ul>
 
384
 
 
385
<div id="searchbox" style="display: none" role="search">
 
386
  <h3>Quick search</h3>
 
387
    <form class="search" action="../search.html" method="get">
 
388
      <input type="text" name="q" />
 
389
      <input type="submit" value="Go" />
 
390
      <input type="hidden" name="check_keywords" value="yes" />
 
391
      <input type="hidden" name="area" value="default" />
 
392
    </form>
 
393
    <p class="searchtip" style="font-size: 90%">
 
394
    Enter search terms or a module, class or function name.
 
395
    </p>
 
396
</div>
 
397
<script type="text/javascript">$('#searchbox').show(0);</script>
 
398
        </div>
 
399
      </div>
 
400
      <div class="clearer"></div>
 
401
    </div>  
 
402
    <div class="related" role="navigation" aria-label="related navigation">
 
403
      <h3>Navigation</h3>
 
404
      <ul>
 
405
        <li class="right" style="margin-right: 10px">
 
406
          <a href="../genindex.html" title="General Index"
 
407
             >index</a></li>
 
408
        <li class="right" >
 
409
          <a href="../py-modindex.html" title="Python Module Index"
 
410
             >modules</a> |</li>
 
411
        <li class="right" >
 
412
          <a href="new.html" title="8.16. new — Creation of runtime internal objects"
 
413
             >next</a> |</li>
 
414
        <li class="right" >
 
415
          <a href="userdict.html" title="8.12. UserDict — Class wrapper for dictionary objects"
 
416
             >previous</a> |</li>
 
417
        <li><img src="../_static/py.png" alt=""
 
418
                 style="vertical-align: middle; margin-top: -1px"/></li>
 
419
        <li><a href="https://www.python.org/">Python</a> &raquo;</li>
 
420
        <li>
 
421
          <span class="version_switcher_placeholder">2.7.11</span>
 
422
          <a href="../index.html">Documentation</a> &raquo;
 
423
        </li>
 
424
 
 
425
          <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &raquo;</li>
 
426
          <li class="nav-item nav-item-2"><a href="datatypes.html" >8. Data Types</a> &raquo;</li> 
 
427
      </ul>
 
428
    </div>  
 
429
    <div class="footer">
 
430
    &copy; <a href="../copyright.html">Copyright</a> 1990-2016, Python Software Foundation.
 
431
    <br />
 
432
    The Python Software Foundation is a non-profit corporation.
 
433
    <a href="https://www.python.org/psf/donations/">Please donate.</a>
 
434
    <br />
 
435
    Last updated on Jan 23, 2016.
 
436
    <a href="../bugs.html">Found a bug</a>?
 
437
    <br />
 
438
    Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.3.3.
 
439
    </div>
 
440
 
 
441
  </body>
 
442
</html>
 
 
b'\\ No newline at end of file'