Sh3ll
OdayForums


Server : Apache
System : Linux server1.cgrithy.com 3.10.0-1160.95.1.el7.x86_64 #1 SMP Mon Jul 24 13:59:37 UTC 2023 x86_64
User : nobody ( 99)
PHP Version : 8.1.23
Disable Function : NONE
Directory :  /usr/share/doc/python-docs-2.7.5/html/library/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/share/doc/python-docs-2.7.5/html/library/new.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>8.16. new — Creation of runtime internal objects &mdash; Python 2.7.5 documentation</title>
    
    <link rel="stylesheet" href="../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '2.7.5',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <script type="text/javascript" src="../_static/sidebar.js"></script>
    <link rel="search" type="application/opensearchdescription+xml"
          title="Search within Python 2.7.5 documentation"
          href="../_static/opensearch.xml"/>
    <link rel="author" title="About these documents" href="../about.html" />
    <link rel="copyright" title="Copyright" href="../copyright.html" />
    <link rel="top" title="Python 2.7.5 documentation" href="../index.html" />
    <link rel="up" title="8. Data Types" href="datatypes.html" />
    <link rel="next" title="8.17. copy — Shallow and deep copy operations" href="copy.html" />
    <link rel="prev" title="8.15. types — Names for built-in types" href="types.html" />
    <link rel="shortcut icon" type="image/png" href="../_static/py.png" />
    <script type="text/javascript" src="../_static/copybutton.js"></script>
    
 

  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="copy.html" title="8.17. copy — Shallow and deep copy operations"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="types.html" title="8.15. types — Names for built-in types"
             accesskey="P">previous</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="http://www.python.org/">Python</a> &raquo;</li>
        <li>
          <a href="../index.html">Python 2.7.5 documentation</a> &raquo;
        </li>

          <li><a href="index.html" >The Python Standard Library</a> &raquo;</li>
          <li><a href="datatypes.html" accesskey="U">8. Data Types</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="module-new">
<span id="new-creation-of-runtime-internal-objects"></span><h1>8.16. <a class="reference internal" href="#module-new" title="new: Interface to the creation of runtime implementation objects. (deprecated)"><tt class="xref py py-mod docutils literal"><span class="pre">new</span></tt></a> &#8212; Creation of runtime internal objects<a class="headerlink" href="#module-new" title="Permalink to this headline">¶</a></h1>
<p class="deprecated">
<span class="versionmodified">Deprecated since version 2.6: </span>The <a class="reference internal" href="#module-new" title="new: Interface to the creation of runtime implementation objects. (deprecated)"><tt class="xref py py-mod docutils literal"><span class="pre">new</span></tt></a> module has been removed in Python 3.  Use the <a class="reference internal" href="types.html#module-types" title="types: Names for built-in types."><tt class="xref py py-mod docutils literal"><span class="pre">types</span></tt></a>
module&#8217;s classes instead.</p>
<p>The <a class="reference internal" href="#module-new" title="new: Interface to the creation of runtime implementation objects. (deprecated)"><tt class="xref py py-mod docutils literal"><span class="pre">new</span></tt></a> module allows an interface to the interpreter object creation
functions. This is for use primarily in marshal-type functions, when a new
object needs to be created &#8220;magically&#8221; and not by using the regular creation
functions. This module provides a low-level interface to the interpreter, so
care must be exercised when using this module. It is possible to supply
non-sensical arguments which crash the interpreter when the object is used.</p>
<p>The <a class="reference internal" href="#module-new" title="new: Interface to the creation of runtime implementation objects. (deprecated)"><tt class="xref py py-mod docutils literal"><span class="pre">new</span></tt></a> module defines the following functions:</p>
<dl class="function">
<dt id="new.instance">
<tt class="descclassname">new.</tt><tt class="descname">instance</tt><big>(</big><em>class</em><span class="optional">[</span>, <em>dict</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#new.instance" title="Permalink to this definition">¶</a></dt>
<dd><p>This function creates an instance of <em>class</em> with dictionary <em>dict</em> without
calling the <a class="reference internal" href="../reference/datamodel.html#object.__init__" title="object.__init__"><tt class="xref py py-meth docutils literal"><span class="pre">__init__()</span></tt></a> constructor.  If <em>dict</em> is omitted or <tt class="docutils literal"><span class="pre">None</span></tt>, a
new, empty dictionary is created for the new instance.  Note that there are no
guarantees that the object will be in a consistent state.</p>
</dd></dl>

<dl class="function">
<dt id="new.instancemethod">
<tt class="descclassname">new.</tt><tt class="descname">instancemethod</tt><big>(</big><em>function</em>, <em>instance</em>, <em>class</em><big>)</big><a class="headerlink" href="#new.instancemethod" title="Permalink to this definition">¶</a></dt>
<dd><p>This function will return a method object, bound to <em>instance</em>, or unbound if
<em>instance</em> is <tt class="docutils literal"><span class="pre">None</span></tt>.  <em>function</em> must be callable.</p>
</dd></dl>

<dl class="function">
<dt id="new.function">
<tt class="descclassname">new.</tt><tt class="descname">function</tt><big>(</big><em>code</em>, <em>globals</em><span class="optional">[</span>, <em>name</em><span class="optional">[</span>, <em>argdefs</em><span class="optional">[</span>, <em>closure</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#new.function" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a (Python) function with the given code and globals. If <em>name</em> is given,
it must be a string or <tt class="docutils literal"><span class="pre">None</span></tt>.  If it is a string, the function will have the
given name, otherwise the function name will be taken from <tt class="docutils literal"><span class="pre">code.co_name</span></tt>.  If
<em>argdefs</em> is given, it must be a tuple and will be used to determine the default
values of parameters.  If <em>closure</em> is given, it must be <tt class="docutils literal"><span class="pre">None</span></tt> or a tuple of
cell objects containing objects to bind to the names in <tt class="docutils literal"><span class="pre">code.co_freevars</span></tt>.</p>
</dd></dl>

<dl class="function">
<dt id="new.code">
<tt class="descclassname">new.</tt><tt class="descname">code</tt><big>(</big><em>argcount</em>, <em>nlocals</em>, <em>stacksize</em>, <em>flags</em>, <em>codestring</em>, <em>constants</em>, <em>names</em>, <em>varnames</em>, <em>filename</em>, <em>name</em>, <em>firstlineno</em>, <em>lnotab</em><big>)</big><a class="headerlink" href="#new.code" title="Permalink to this definition">¶</a></dt>
<dd><p>This function is an interface to the <a class="reference internal" href="../c-api/code.html#PyCode_New" title="PyCode_New"><tt class="xref c c-func docutils literal"><span class="pre">PyCode_New()</span></tt></a> C function.</p>
</dd></dl>

<dl class="function">
<dt id="new.module">
<tt class="descclassname">new.</tt><tt class="descname">module</tt><big>(</big><em>name</em><span class="optional">[</span>, <em>doc</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#new.module" title="Permalink to this definition">¶</a></dt>
<dd><p>This function returns a new module object with name <em>name</em>. <em>name</em> must be a
string. The optional <em>doc</em> argument can have any type.</p>
</dd></dl>

<dl class="function">
<dt id="new.classobj">
<tt class="descclassname">new.</tt><tt class="descname">classobj</tt><big>(</big><em>name</em>, <em>baseclasses</em>, <em>dict</em><big>)</big><a class="headerlink" href="#new.classobj" title="Permalink to this definition">¶</a></dt>
<dd><p>This function returns a new class object, with name <em>name</em>, derived from
<em>baseclasses</em> (which should be a tuple of classes) and with namespace <em>dict</em>.</p>
</dd></dl>

</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h4>Previous topic</h4>
  <p class="topless"><a href="types.html"
                        title="previous chapter">8.15. <tt class="docutils literal"><span class="pre">types</span></tt> &#8212; Names for built-in types</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="copy.html"
                        title="next chapter">8.17. <tt class="docutils literal"><span class="pre">copy</span></tt> &#8212; Shallow and deep copy operations</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
  <li><a href="../bugs.html">Report a Bug</a></li>
  <li><a href="../_sources/library/new.txt"
         rel="nofollow">Show Source</a></li>
</ul>

<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="copy.html" title="8.17. copy — Shallow and deep copy operations"
             >next</a> |</li>
        <li class="right" >
          <a href="types.html" title="8.15. types — Names for built-in types"
             >previous</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="http://www.python.org/">Python</a> &raquo;</li>
        <li>
          <a href="../index.html">Python 2.7.5 documentation</a> &raquo;
        </li>

          <li><a href="index.html" >The Python Standard Library</a> &raquo;</li>
          <li><a href="datatypes.html" >8. Data Types</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
    &copy; <a href="../copyright.html">Copyright</a> 1990-2020, Python Software Foundation.
    <br />
    The Python Software Foundation is a non-profit corporation.
    <a href="http://www.python.org/psf/donations/">Please donate.</a>
    <br />
    Last updated on Oct 13, 2020.
    <a href="../bugs.html">Found a bug</a>?
    <br />
    Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
    </div>

  </body>
</html>

ZeroDay Forums Mini