晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。   林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。   见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝)   既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。   南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。 .
Prv8 Shell
Server : Apache
System : Linux srv.rainic.com 4.18.0-553.47.1.el8_10.x86_64 #1 SMP Wed Apr 2 05:45:37 EDT 2025 x86_64
User : rainic ( 1014)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /usr/share/doc/python2-docs/html/library/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/share/doc/python2-docs/html/library/types.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>8.15. types — Names for built-in types &#8212; Python 2.7.16 documentation</title>
    <link rel="stylesheet" href="../_static/classic.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <script type="text/javascript" src="../_static/sidebar.js"></script>
    <link rel="search" type="application/opensearchdescription+xml"
          title="Search within Python 2.7.16 documentation"
          href="../_static/opensearch.xml"/>
    <link rel="author" title="About these documents" href="../about.html" />
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="copyright" title="Copyright" href="../copyright.html" />
    <link rel="next" title="8.16. new — Creation of runtime internal objects" href="new.html" />
    <link rel="prev" title="8.12. UserDict — Class wrapper for dictionary objects" href="userdict.html" />
    <link rel="shortcut icon" type="image/png" href="../_static/py.png" />
    <link rel="canonical" href="https://docs.python.org/2/library/types.html" />
    <script type="text/javascript" src="../_static/copybutton.js"></script>
    
 
    

  </head><body>  
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="new.html" title="8.16. new — Creation of runtime internal objects"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="userdict.html" title="8.12. UserDict — Class wrapper for dictionary objects"
             accesskey="P">previous</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="https://www.python.org/">Python</a> &#187;</li>
        <li>
          <a href="../index.html">Python 2.7.16 documentation</a> &#187;
        </li>

          <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &#187;</li>
          <li class="nav-item nav-item-2"><a href="datatypes.html" accesskey="U">8. Data Types</a> &#187;</li> 
      </ul>
    </div>    

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="module-types">
<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 notranslate"><span class="pre">types</span></code></a> — Names for built-in types<a class="headerlink" href="#module-types" title="Permalink to this headline">¶</a></h1>
<p><strong>Source code:</strong> <a class="reference external" href="https://github.com/python/cpython/tree/2.7/Lib/types.py">Lib/types.py</a></p>
<hr class="docutils" />
<p>This module defines names for some object types that are used by the standard
Python interpreter, but not for the types defined by various extension modules.
Also, it does not include some of the types that arise during processing such as
the <code class="docutils literal notranslate"><span class="pre">listiterator</span></code> type. It is safe to use <code class="docutils literal notranslate"><span class="pre">from</span> <span class="pre">types</span> <span class="pre">import</span> <span class="pre">*</span></code> — the
module does not export any names besides the ones listed here. New names
exported by future versions of this module will all end in <code class="docutils literal notranslate"><span class="pre">Type</span></code>.</p>
<p>Typical use is for functions that do different things depending on their
argument types, like the following:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">types</span> <span class="k">import</span> <span class="o">*</span>
<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>
    <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>
       <span class="k">del</span> <span class="n">mylist</span><span class="p">[</span><span class="n">item</span><span class="p">]</span>
    <span class="k">else</span><span class="p">:</span>
       <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>
</pre></div>
</div>
<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 notranslate"><span class="pre">int()</span></code></a> and
<a class="reference internal" href="functions.html#str" title="str"><code class="xref py py-func docutils literal notranslate"><span class="pre">str()</span></code></a> are also names for the corresponding types.  This is now the
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 notranslate"><span class="pre">types</span></code></a> module.
Accordingly, the example above should be written as follows:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><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>
    <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>
       <span class="k">del</span> <span class="n">mylist</span><span class="p">[</span><span class="n">item</span><span class="p">]</span>
    <span class="k">else</span><span class="p">:</span>
       <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>
</pre></div>
</div>
<p>The module defines the following names:</p>
<dl class="data">
<dt id="types.NoneType">
<code class="descclassname">types.</code><code class="descname">NoneType</code><a class="headerlink" href="#types.NoneType" title="Permalink to this definition">¶</a></dt>
<dd><p>The type of <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p>
</dd></dl>

<dl class="data">
<dt id="types.TypeType">
<code class="descclassname">types.</code><code class="descname">TypeType</code><a class="headerlink" href="#types.TypeType" title="Permalink to this definition">¶</a></dt>
<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 notranslate"><span class="pre">type()</span></code></a>); alias of the
built-in <a class="reference internal" href="functions.html#type" title="type"><code class="xref py py-class docutils literal notranslate"><span class="pre">type</span></code></a>.</p>
</dd></dl>

<dl class="data">
<dt id="types.BooleanType">
<code class="descclassname">types.</code><code class="descname">BooleanType</code><a class="headerlink" href="#types.BooleanType" title="Permalink to this definition">¶</a></dt>
<dd><p>The type of the <a class="reference internal" href="functions.html#bool" title="bool"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a> values <code class="docutils literal notranslate"><span class="pre">True</span></code> and <code class="docutils literal notranslate"><span class="pre">False</span></code>; alias of the
built-in <a class="reference internal" href="functions.html#bool" title="bool"><code class="xref py py-class docutils literal notranslate"><span class="pre">bool</span></code></a>.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 2.3.</span></p>
</div>
</dd></dl>

<dl class="data">
<dt id="types.IntType">
<code class="descclassname">types.</code><code class="descname">IntType</code><a class="headerlink" href="#types.IntType" title="Permalink to this definition">¶</a></dt>
<dd><p>The type of integers (e.g. <code class="docutils literal notranslate"><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 notranslate"><span class="pre">int</span></code></a>.</p>
</dd></dl>

<dl class="data">
<dt id="types.LongType">
<code class="descclassname">types.</code><code class="descname">LongType</code><a class="headerlink" href="#types.LongType" title="Permalink to this definition">¶</a></dt>
<dd><p>The type of long integers (e.g. <code class="docutils literal notranslate"><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 notranslate"><span class="pre">long</span></code></a>.</p>
</dd></dl>

<dl class="data">
<dt id="types.FloatType">
<code class="descclassname">types.</code><code class="descname">FloatType</code><a class="headerlink" href="#types.FloatType" title="Permalink to this definition">¶</a></dt>
<dd><p>The type of floating point numbers (e.g. <code class="docutils literal notranslate"><span class="pre">1.0</span></code>); alias of the built-in
<a class="reference internal" href="functions.html#float" title="float"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>.</p>
</dd></dl>

<dl class="data">
<dt id="types.ComplexType">
<code class="descclassname">types.</code><code class="descname">ComplexType</code><a class="headerlink" href="#types.ComplexType" title="Permalink to this definition">¶</a></dt>
<dd><p>The type of complex numbers (e.g. <code class="docutils literal notranslate"><span class="pre">1.0j</span></code>).  This is not defined if Python was
built without complex number support.</p>
</dd></dl>

<dl class="data">
<dt id="types.StringType">
<code class="descclassname">types.</code><code class="descname">StringType</code><a class="headerlink" href="#types.StringType" title="Permalink to this definition">¶</a></dt>
<dd><p>The type of character strings (e.g. <code class="docutils literal notranslate"><span class="pre">'Spam'</span></code>); alias of the built-in
<a class="reference internal" href="functions.html#str" title="str"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a>.</p>
</dd></dl>

<dl class="data">
<dt id="types.UnicodeType">
<code class="descclassname">types.</code><code class="descname">UnicodeType</code><a class="headerlink" href="#types.UnicodeType" title="Permalink to this definition">¶</a></dt>
<dd><p>The type of Unicode character strings (e.g. <code class="docutils literal notranslate"><span class="pre">u'Spam'</span></code>).  This is not defined
if Python was built without Unicode support.  It’s an alias of the built-in
<a class="reference internal" href="functions.html#unicode" title="unicode"><code class="xref py py-class docutils literal notranslate"><span class="pre">unicode</span></code></a>.</p>
</dd></dl>

<dl class="data">
<dt id="types.TupleType">
<code class="descclassname">types.</code><code class="descname">TupleType</code><a class="headerlink" href="#types.TupleType" title="Permalink to this definition">¶</a></dt>
<dd><p>The type of tuples (e.g. <code class="docutils literal notranslate"><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
<a class="reference internal" href="functions.html#tuple" title="tuple"><code class="xref py py-class docutils literal notranslate"><span class="pre">tuple</span></code></a>.</p>
</dd></dl>

<dl class="data">
<dt id="types.ListType">
<code class="descclassname">types.</code><code class="descname">ListType</code><a class="headerlink" href="#types.ListType" title="Permalink to this definition">¶</a></dt>
<dd><p>The type of lists (e.g. <code class="docutils literal notranslate"><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
<code class="xref py py-class docutils literal notranslate"><span class="pre">list</span></code>.</p>
</dd></dl>

<dl class="data">
<dt id="types.DictType">
<code class="descclassname">types.</code><code class="descname">DictType</code><a class="headerlink" href="#types.DictType" title="Permalink to this definition">¶</a></dt>
<dd><p>The type of dictionaries (e.g. <code class="docutils literal notranslate"><span class="pre">{'Bacon':</span> <span class="pre">1,</span> <span class="pre">'Ham':</span> <span class="pre">0}</span></code>); alias of the
built-in <a class="reference internal" href="stdtypes.html#dict" title="dict"><code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></a>.</p>
</dd></dl>

<dl class="data">
<dt id="types.DictionaryType">
<code class="descclassname">types.</code><code class="descname">DictionaryType</code><a class="headerlink" href="#types.DictionaryType" title="Permalink to this definition">¶</a></dt>
<dd><p>An alternate name for <code class="docutils literal notranslate"><span class="pre">DictType</span></code>.</p>
</dd></dl>

<dl class="data">
<dt id="types.FunctionType">
<code class="descclassname">types.</code><code class="descname">FunctionType</code><a class="headerlink" href="#types.FunctionType" title="Permalink to this definition">¶</a></dt>
<dt id="types.LambdaType">
<code class="descclassname">types.</code><code class="descname">LambdaType</code><a class="headerlink" href="#types.LambdaType" title="Permalink to this definition">¶</a></dt>
<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 notranslate"><span class="pre">lambda</span></code></a>
expressions.</p>
</dd></dl>

<dl class="data">
<dt id="types.GeneratorType">
<code class="descclassname">types.</code><code class="descname">GeneratorType</code><a class="headerlink" href="#types.GeneratorType" title="Permalink to this definition">¶</a></dt>
<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
generator function.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 2.2.</span></p>
</div>
</dd></dl>

<dl class="data">
<dt id="types.CodeType">
<code class="descclassname">types.</code><code class="descname">CodeType</code><a class="headerlink" href="#types.CodeType" title="Permalink to this definition">¶</a></dt>
<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 notranslate"><span class="pre">compile()</span></code></a>.</p>
</dd></dl>

<dl class="data">
<dt id="types.ClassType">
<code class="descclassname">types.</code><code class="descname">ClassType</code><a class="headerlink" href="#types.ClassType" title="Permalink to this definition">¶</a></dt>
<dd><p>The type of user-defined old-style classes.</p>
</dd></dl>

<dl class="data">
<dt id="types.InstanceType">
<code class="descclassname">types.</code><code class="descname">InstanceType</code><a class="headerlink" href="#types.InstanceType" title="Permalink to this definition">¶</a></dt>
<dd><p>The type of instances of user-defined old-style classes.</p>
</dd></dl>

<dl class="data">
<dt id="types.MethodType">
<code class="descclassname">types.</code><code class="descname">MethodType</code><a class="headerlink" href="#types.MethodType" title="Permalink to this definition">¶</a></dt>
<dd><p>The type of methods of user-defined class instances.</p>
</dd></dl>

<dl class="data">
<dt id="types.UnboundMethodType">
<code class="descclassname">types.</code><code class="descname">UnboundMethodType</code><a class="headerlink" href="#types.UnboundMethodType" title="Permalink to this definition">¶</a></dt>
<dd><p>An alternate name for <code class="docutils literal notranslate"><span class="pre">MethodType</span></code>.</p>
</dd></dl>

<dl class="data">
<dt id="types.BuiltinFunctionType">
<code class="descclassname">types.</code><code class="descname">BuiltinFunctionType</code><a class="headerlink" href="#types.BuiltinFunctionType" title="Permalink to this definition">¶</a></dt>
<dt id="types.BuiltinMethodType">
<code class="descclassname">types.</code><code class="descname">BuiltinMethodType</code><a class="headerlink" href="#types.BuiltinMethodType" title="Permalink to this definition">¶</a></dt>
<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 notranslate"><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 notranslate"><span class="pre">sys.exit()</span></code></a>, and
methods of built-in classes.  (Here, the term “built-in” means “written in
C”.)</p>
</dd></dl>

<dl class="data">
<dt id="types.ModuleType">
<code class="descclassname">types.</code><code class="descname">ModuleType</code><a class="headerlink" href="#types.ModuleType" title="Permalink to this definition">¶</a></dt>
<dd><p>The type of modules.</p>
</dd></dl>

<dl class="data">
<dt id="types.FileType">
<code class="descclassname">types.</code><code class="descname">FileType</code><a class="headerlink" href="#types.FileType" title="Permalink to this definition">¶</a></dt>
<dd><p>The type of open file objects such as <code class="docutils literal notranslate"><span class="pre">sys.stdout</span></code>; alias of the built-in
<a class="reference internal" href="functions.html#file" title="file"><code class="xref py py-class docutils literal notranslate"><span class="pre">file</span></code></a>.</p>
</dd></dl>

<dl class="data">
<dt id="types.XRangeType">
<code class="descclassname">types.</code><code class="descname">XRangeType</code><a class="headerlink" href="#types.XRangeType" title="Permalink to this definition">¶</a></dt>
<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 notranslate"><span class="pre">xrange()</span></code></a>; alias of the built-in
<a class="reference internal" href="functions.html#xrange" title="xrange"><code class="xref py py-class docutils literal notranslate"><span class="pre">xrange</span></code></a>.</p>
</dd></dl>

<dl class="data">
<dt id="types.SliceType">
<code class="descclassname">types.</code><code class="descname">SliceType</code><a class="headerlink" href="#types.SliceType" title="Permalink to this definition">¶</a></dt>
<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 notranslate"><span class="pre">slice()</span></code></a>; alias of the built-in
<a class="reference internal" href="functions.html#slice" title="slice"><code class="xref py py-class docutils literal notranslate"><span class="pre">slice</span></code></a>.</p>
</dd></dl>

<dl class="data">
<dt id="types.EllipsisType">
<code class="descclassname">types.</code><code class="descname">EllipsisType</code><a class="headerlink" href="#types.EllipsisType" title="Permalink to this definition">¶</a></dt>
<dd><p>The type of <code class="docutils literal notranslate"><span class="pre">Ellipsis</span></code>.</p>
</dd></dl>

<dl class="data">
<dt id="types.TracebackType">
<code class="descclassname">types.</code><code class="descname">TracebackType</code><a class="headerlink" href="#types.TracebackType" title="Permalink to this definition">¶</a></dt>
<dd><p>The type of traceback objects such as found in <code class="docutils literal notranslate"><span class="pre">sys.exc_traceback</span></code>.</p>
</dd></dl>

<dl class="data">
<dt id="types.FrameType">
<code class="descclassname">types.</code><code class="descname">FrameType</code><a class="headerlink" href="#types.FrameType" title="Permalink to this definition">¶</a></dt>
<dd><p>The type of frame objects such as found in <code class="docutils literal notranslate"><span class="pre">tb.tb_frame</span></code> if <code class="docutils literal notranslate"><span class="pre">tb</span></code> is a
traceback object.</p>
</dd></dl>

<dl class="data">
<dt id="types.BufferType">
<code class="descclassname">types.</code><code class="descname">BufferType</code><a class="headerlink" href="#types.BufferType" title="Permalink to this definition">¶</a></dt>
<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 notranslate"><span class="pre">buffer()</span></code></a> function.</p>
</dd></dl>

<dl class="data">
<dt id="types.DictProxyType">
<code class="descclassname">types.</code><code class="descname">DictProxyType</code><a class="headerlink" href="#types.DictProxyType" title="Permalink to this definition">¶</a></dt>
<dd><p>The type of dict proxies, such as <code class="docutils literal notranslate"><span class="pre">TypeType.__dict__</span></code>.</p>
</dd></dl>

<dl class="data">
<dt id="types.NotImplementedType">
<code class="descclassname">types.</code><code class="descname">NotImplementedType</code><a class="headerlink" href="#types.NotImplementedType" title="Permalink to this definition">¶</a></dt>
<dd><p>The type of <code class="docutils literal notranslate"><span class="pre">NotImplemented</span></code></p>
</dd></dl>

<dl class="data">
<dt id="types.GetSetDescriptorType">
<code class="descclassname">types.</code><code class="descname">GetSetDescriptorType</code><a class="headerlink" href="#types.GetSetDescriptorType" title="Permalink to this definition">¶</a></dt>
<dd><p>The type of objects defined in extension modules with <code class="docutils literal notranslate"><span class="pre">PyGetSetDef</span></code>, such
as <code class="docutils literal notranslate"><span class="pre">FrameType.f_locals</span></code> or <code class="docutils literal notranslate"><span class="pre">array.array.typecode</span></code>.  This type is used as
descriptor for object attributes; it has the same purpose as the
<a class="reference internal" href="functions.html#property" title="property"><code class="xref py py-class docutils literal notranslate"><span class="pre">property</span></code></a> type, but for classes defined in extension modules.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 2.5.</span></p>
</div>
</dd></dl>

<dl class="data">
<dt id="types.MemberDescriptorType">
<code class="descclassname">types.</code><code class="descname">MemberDescriptorType</code><a class="headerlink" href="#types.MemberDescriptorType" title="Permalink to this definition">¶</a></dt>
<dd><p>The type of objects defined in extension modules with <code class="docutils literal notranslate"><span class="pre">PyMemberDef</span></code>, such
as <code class="docutils literal notranslate"><span class="pre">datetime.timedelta.days</span></code>.  This type is used as descriptor for simple C
data members which use standard conversion functions; it has the same purpose
as the <a class="reference internal" href="functions.html#property" title="property"><code class="xref py py-class docutils literal notranslate"><span class="pre">property</span></code></a> type, but for classes defined in extension modules.</p>
<div class="impl-detail compound">
<p><strong>CPython implementation detail:</strong> In other implementations of Python, this type may be identical to
<code class="docutils literal notranslate"><span class="pre">GetSetDescriptorType</span></code>.</p>
</div>
<div class="versionadded">
<p><span class="versionmodified">New in version 2.5.</span></p>
</div>
</dd></dl>

<dl class="data">
<dt id="types.StringTypes">
<code class="descclassname">types.</code><code class="descname">StringTypes</code><a class="headerlink" href="#types.StringTypes" title="Permalink to this definition">¶</a></dt>
<dd><p>A sequence containing <code class="docutils literal notranslate"><span class="pre">StringType</span></code> and <code class="docutils literal notranslate"><span class="pre">UnicodeType</span></code> used to facilitate
easier checking for any string object.  Using this is more portable than using a
sequence of the two string types constructed elsewhere since it only contains
<code class="docutils literal notranslate"><span class="pre">UnicodeType</span></code> if it has been built in the running version of Python.  For
example: <code class="docutils literal notranslate"><span class="pre">isinstance(s,</span> <span class="pre">types.StringTypes)</span></code>.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 2.2.</span></p>
</div>
</dd></dl>

</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h4>Previous topic</h4>
  <p class="topless"><a href="userdict.html"
                        title="previous chapter">8.12. <code class="docutils literal notranslate"><span class="pre">UserDict</span></code> — Class wrapper for dictionary objects</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="new.html"
                        title="next chapter">8.16. <code class="docutils literal notranslate"><span class="pre">new</span></code> — Creation of runtime internal objects</a></p>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="../_sources/library/types.rst.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3>Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    </div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>  
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="new.html" title="8.16. new — Creation of runtime internal objects"
             >next</a> |</li>
        <li class="right" >
          <a href="userdict.html" title="8.12. UserDict — Class wrapper for dictionary objects"
             >previous</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="https://www.python.org/">Python</a> &#187;</li>
        <li>
          <a href="../index.html">Python 2.7.16 documentation</a> &#187;
        </li>

          <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &#187;</li>
          <li class="nav-item nav-item-2"><a href="datatypes.html" >8. Data Types</a> &#187;</li> 
      </ul>
    </div>  
    <div class="footer">
    &copy; <a href="../copyright.html">Copyright</a> 1990-2019, Python Software Foundation.
    <br />
    The Python Software Foundation is a non-profit corporation.
    <a href="https://www.python.org/psf/donations/">Please donate.</a>
    <br />
    Last updated on Mar 27, 2019.
    <a href="../bugs.html">Found a bug</a>?
    <br />
    Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.7.6.
    </div>

  </body>
</html>

haha - 2025