Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / src / nas,5.n2.os.2 / lib / python / html / python / lib / non-essential-built-in-funcs.html
CommitLineData
86530b38
AT
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<html>
3<head>
4<link rel="STYLESHEET" href="lib.css" type='text/css' />
5<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
6<link rel='start' href='../index.html' title='Python Documentation Index' />
7<link rel="first" href="lib.html" title='Python Library Reference' />
8<link rel='contents' href='contents.html' title="Contents" />
9<link rel='index' href='genindex.html' title='Index' />
10<link rel='last' href='about.html' title='About this document...' />
11<link rel='help' href='about.html' title='About this document...' />
12<link rel="next" href="types.html" />
13<link rel="prev" href="built-in-funcs.html" />
14<link rel="parent" href="builtin.html" />
15<link rel="next" href="types.html" />
16<meta name='aesop' content='information' />
17<title>2.2 Non-essential Built-in Functions </title>
18</head>
19<body>
20<DIV CLASS="navigation">
21<div id='top-navigation-panel' xml:id='top-navigation-panel'>
22<table align="center" width="100%" cellpadding="0" cellspacing="2">
23<tr>
24<td class='online-navigation'><a rel="prev" title="2.1 Built-in Functions"
25 href="built-in-funcs.html"><img src='../icons/previous.png'
26 border='0' height='32' alt='Previous Page' width='32' /></A></td>
27<td class='online-navigation'><a rel="parent" title="2. Built-In Objects"
28 href="builtin.html"><img src='../icons/up.png'
29 border='0' height='32' alt='Up One Level' width='32' /></A></td>
30<td class='online-navigation'><a rel="next" title="2.3 Built-in Types"
31 href="types.html"><img src='../icons/next.png'
32 border='0' height='32' alt='Next Page' width='32' /></A></td>
33<td align="center" width="100%">Python Library Reference</td>
34<td class='online-navigation'><a rel="contents" title="Table of Contents"
35 href="contents.html"><img src='../icons/contents.png'
36 border='0' height='32' alt='Contents' width='32' /></A></td>
37<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
38 border='0' height='32' alt='Module Index' width='32' /></a></td>
39<td class='online-navigation'><a rel="index" title="Index"
40 href="genindex.html"><img src='../icons/index.png'
41 border='0' height='32' alt='Index' width='32' /></A></td>
42</tr></table>
43<div class='online-navigation'>
44<b class="navlabel">Previous:</b>
45<a class="sectref" rel="prev" href="built-in-funcs.html">2.1 Built-in Functions</A>
46<b class="navlabel">Up:</b>
47<a class="sectref" rel="parent" href="builtin.html">2. Built-In Objects</A>
48<b class="navlabel">Next:</b>
49<a class="sectref" rel="next" href="types.html">2.3 Built-in Types</A>
50</div>
51<hr /></div>
52</DIV>
53<!--End of Navigation Panel-->
54
55<H1><A NAME="SECTION004200000000000000000"></A><A NAME="non-essential-built-in-funcs"></A>
56<BR>
572.2 Non-essential Built-in Functions
58</H1>
59
60<P>
61There are several built-in functions that are no longer essential to learn,
62know or use in modern Python programming. They have been kept here to
63maintain backwards compatibility with programs written for older versions
64of Python.
65
66<P>
67Python programmers, trainers, students and bookwriters should feel free to
68bypass these functions without concerns about missing something important.
69
70<P>
71
72<P>
73<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
74 <td><nobr><b><tt id='l2h-85' xml:id='l2h-85' class="function">apply</tt></b>(</nobr></td>
75 <td><var>function, args</var><big>[</big><var>, keywords</var><big>]</big><var></var>)</td></tr></table></dt>
76<dd>
77 The <var>function</var> argument must be a callable object (a
78 user-defined or built-in function or method, or a class object) and
79 the <var>args</var> argument must be a sequence. The <var>function</var> is
80 called with <var>args</var> as the argument list; the number of arguments
81 is the length of the tuple.
82 If the optional <var>keywords</var> argument is present, it must be a
83 dictionary whose keys are strings. It specifies keyword arguments
84 to be added to the end of the argument list.
85 Calling <tt class="function">apply()</tt> is different from just calling
86 <code><var>function</var>(<var>args</var>)</code>, since in that case there is always
87 exactly one argument. The use of <tt class="function">apply()</tt> is equivalent
88 to <code><var>function</var>(*<var>args</var>, **<var>keywords</var>)</code>.
89 Use of <tt class="function">apply()</tt> is not necessary since the ``extended call
90 syntax,'' as used in the last example, is completely equivalent.
91
92<P>
93<div class="versionnote"><b>Deprecated since release 2.3.</b>
94Use the extended call syntax instead, as described
95 above.</div><p></p>
96</dl>
97
98<P>
99<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
100 <td><nobr><b><tt id='l2h-86' xml:id='l2h-86' class="function">buffer</tt></b>(</nobr></td>
101 <td><var>object</var><big>[</big><var>, offset</var><big>[</big><var>, size</var><big>]</big><var></var><big>]</big><var></var>)</td></tr></table></dt>
102<dd>
103 The <var>object</var> argument must be an object that supports the buffer
104 call interface (such as strings, arrays, and buffers). A new buffer
105 object will be created which references the <var>object</var> argument.
106 The buffer object will be a slice from the beginning of <var>object</var>
107 (or from the specified <var>offset</var>). The slice will extend to the
108 end of <var>object</var> (or will have a length given by the <var>size</var>
109 argument).
110</dl>
111
112<P>
113<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
114 <td><nobr><b><tt id='l2h-87' xml:id='l2h-87' class="function">coerce</tt></b>(</nobr></td>
115 <td><var>x, y</var>)</td></tr></table></dt>
116<dd>
117 Return a tuple consisting of the two numeric arguments converted to
118 a common type, using the same rules as used by arithmetic
119 operations. If coercion is not possible, raise <tt class="exception">TypeError</tt>.
120</dl>
121
122<P>
123<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
124 <td><nobr><b><tt id='l2h-88' xml:id='l2h-88' class="function">intern</tt></b>(</nobr></td>
125 <td><var>string</var>)</td></tr></table></dt>
126<dd>
127 Enter <var>string</var> in the table of ``interned'' strings and return
128 the interned string - which is <var>string</var> itself or a copy.
129 Interning strings is useful to gain a little performance on
130 dictionary lookup - if the keys in a dictionary are interned, and
131 the lookup key is interned, the key comparisons (after hashing) can
132 be done by a pointer compare instead of a string compare. Normally,
133 the names used in Python programs are automatically interned, and
134 the dictionaries used to hold module, class or instance attributes
135 have interned keys.
136<span class="versionnote">Changed in version 2.3:
137Interned strings are not
138 immortal (like they used to be in Python 2.2 and before);
139 you must keep a reference to the return value of <tt class="function">intern()</tt>
140 around to benefit from it.</span>
141
142</dl>
143
144<DIV CLASS="navigation">
145<div class='online-navigation'>
146<p></p><hr />
147<table align="center" width="100%" cellpadding="0" cellspacing="2">
148<tr>
149<td class='online-navigation'><a rel="prev" title="2.1 Built-in Functions"
150 href="built-in-funcs.html"><img src='../icons/previous.png'
151 border='0' height='32' alt='Previous Page' width='32' /></A></td>
152<td class='online-navigation'><a rel="parent" title="2. Built-In Objects"
153 href="builtin.html"><img src='../icons/up.png'
154 border='0' height='32' alt='Up One Level' width='32' /></A></td>
155<td class='online-navigation'><a rel="next" title="2.3 Built-in Types"
156 href="types.html"><img src='../icons/next.png'
157 border='0' height='32' alt='Next Page' width='32' /></A></td>
158<td align="center" width="100%">Python Library Reference</td>
159<td class='online-navigation'><a rel="contents" title="Table of Contents"
160 href="contents.html"><img src='../icons/contents.png'
161 border='0' height='32' alt='Contents' width='32' /></A></td>
162<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
163 border='0' height='32' alt='Module Index' width='32' /></a></td>
164<td class='online-navigation'><a rel="index" title="Index"
165 href="genindex.html"><img src='../icons/index.png'
166 border='0' height='32' alt='Index' width='32' /></A></td>
167</tr></table>
168<div class='online-navigation'>
169<b class="navlabel">Previous:</b>
170<a class="sectref" rel="prev" href="built-in-funcs.html">2.1 Built-in Functions</A>
171<b class="navlabel">Up:</b>
172<a class="sectref" rel="parent" href="builtin.html">2. Built-In Objects</A>
173<b class="navlabel">Next:</b>
174<a class="sectref" rel="next" href="types.html">2.3 Built-in Types</A>
175</div>
176</div>
177<hr />
178<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
179</DIV>
180<!--End of Navigation Panel-->
181<ADDRESS>
182See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
183</ADDRESS>
184</BODY>
185</HTML>