| 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="inspect-stack.html" /> |
| 13 | <link rel="prev" href="inspect-source.html" /> |
| 14 | <link rel="parent" href="module-inspect.html" /> |
| 15 | <link rel="next" href="inspect-stack.html" /> |
| 16 | <meta name='aesop' content='information' /> |
| 17 | <title>3.11.3 Classes and 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="3.11.2 Retrieving source code" |
| 25 | href="inspect-source.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="3.11 inspect " |
| 28 | href="module-inspect.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="3.11.4 The interpreter stack" |
| 31 | href="inspect-stack.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="inspect-source.html">3.11.2 Retrieving source code</A> |
| 46 | <b class="navlabel">Up:</b> |
| 47 | <a class="sectref" rel="parent" href="module-inspect.html">3.11 inspect </A> |
| 48 | <b class="navlabel">Next:</b> |
| 49 | <a class="sectref" rel="next" href="inspect-stack.html">3.11.4 The interpreter stack</A> |
| 50 | </div> |
| 51 | <hr /></div> |
| 52 | </DIV> |
| 53 | <!--End of Navigation Panel--> |
| 54 | |
| 55 | <H2><A NAME="SECTION0051130000000000000000"></A><A NAME="inspect-classes-functions"></A> |
| 56 | <BR> |
| 57 | 3.11.3 Classes and functions |
| 58 | |
| 59 | </H2> |
| 60 | |
| 61 | <P> |
| 62 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 63 | <td><nobr><b><tt id='l2h-592' xml:id='l2h-592' class="function">getclasstree</tt></b>(</nobr></td> |
| 64 | <td><var>classes</var><big>[</big><var>, unique</var><big>]</big><var></var>)</td></tr></table></dt> |
| 65 | <dd> |
| 66 | Arrange the given list of classes into a hierarchy of nested lists. |
| 67 | Where a nested list appears, it contains classes derived from the class |
| 68 | whose entry immediately precedes the list. Each entry is a 2-tuple |
| 69 | containing a class and a tuple of its base classes. If the <var>unique</var> |
| 70 | argument is true, exactly one entry appears in the returned structure |
| 71 | for each class in the given list. Otherwise, classes using multiple |
| 72 | inheritance and their descendants will appear multiple times. |
| 73 | </dl> |
| 74 | |
| 75 | <P> |
| 76 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 77 | <td><nobr><b><tt id='l2h-593' xml:id='l2h-593' class="function">getargspec</tt></b>(</nobr></td> |
| 78 | <td><var>func</var>)</td></tr></table></dt> |
| 79 | <dd> |
| 80 | Get the names and default values of a function's arguments. |
| 81 | A tuple of four things is returned: <code>(<var>args</var>, |
| 82 | <var>varargs</var>, <var>varkw</var>, <var>defaults</var>)</code>. |
| 83 | <var>args</var> is a list of the argument names (it may contain nested lists). |
| 84 | <var>varargs</var> and <var>varkw</var> are the names of the <code>*</code> and |
| 85 | <code>**</code> arguments or <code>None</code>. |
| 86 | <var>defaults</var> is a tuple of default argument values or None if there are no |
| 87 | default arguments; if this tuple has <var>n</var> elements, they correspond to |
| 88 | the last <var>n</var> elements listed in <var>args</var>. |
| 89 | </dl> |
| 90 | |
| 91 | <P> |
| 92 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 93 | <td><nobr><b><tt id='l2h-594' xml:id='l2h-594' class="function">getargvalues</tt></b>(</nobr></td> |
| 94 | <td><var>frame</var>)</td></tr></table></dt> |
| 95 | <dd> |
| 96 | Get information about arguments passed into a particular frame. |
| 97 | A tuple of four things is returned: <code>(<var>args</var>, |
| 98 | <var>varargs</var>, <var>varkw</var>, <var>locals</var>)</code>. |
| 99 | <var>args</var> is a list of the argument names (it may contain nested |
| 100 | lists). |
| 101 | <var>varargs</var> and <var>varkw</var> are the names of the <code>*</code> and |
| 102 | <code>**</code> arguments or <code>None</code>. |
| 103 | <var>locals</var> is the locals dictionary of the given frame. |
| 104 | </dl> |
| 105 | |
| 106 | <P> |
| 107 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 108 | <td><nobr><b><tt id='l2h-595' xml:id='l2h-595' class="function">formatargspec</tt></b>(</nobr></td> |
| 109 | <td><var>args</var><big>[</big><var>, varargs, varkw, defaults, |
| 110 | argformat, varargsformat, varkwformat, defaultformat</var><big>]</big><var></var>)</td></tr></table></dt> |
| 111 | <dd> |
| 112 | |
| 113 | <P> |
| 114 | Format a pretty argument spec from the four values returned by |
| 115 | <tt class="function">getargspec()</tt>. The other four arguments are the |
| 116 | corresponding optional formatting functions that are called to turn |
| 117 | names and values into strings. |
| 118 | </dl> |
| 119 | |
| 120 | <P> |
| 121 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 122 | <td><nobr><b><tt id='l2h-596' xml:id='l2h-596' class="function">formatargvalues</tt></b>(</nobr></td> |
| 123 | <td><var>args</var><big>[</big><var>, varargs, varkw, locals, |
| 124 | argformat, varargsformat, varkwformat, valueformat</var><big>]</big><var></var>)</td></tr></table></dt> |
| 125 | <dd> |
| 126 | Format a pretty argument spec from the four values returned by |
| 127 | <tt class="function">getargvalues()</tt>. The other four arguments are the |
| 128 | corresponding optional formatting functions that are called to turn |
| 129 | names and values into strings. |
| 130 | </dl> |
| 131 | |
| 132 | <P> |
| 133 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 134 | <td><nobr><b><tt id='l2h-597' xml:id='l2h-597' class="function">getmro</tt></b>(</nobr></td> |
| 135 | <td><var>cls</var>)</td></tr></table></dt> |
| 136 | <dd> |
| 137 | Return a tuple of class cls's base classes, including cls, in |
| 138 | method resolution order. No class appears more than once in this tuple. |
| 139 | Note that the method resolution order depends on cls's type. Unless a |
| 140 | very peculiar user-defined metatype is in use, cls will be the first |
| 141 | element of the tuple. |
| 142 | </dl> |
| 143 | |
| 144 | <P> |
| 145 | |
| 146 | <DIV CLASS="navigation"> |
| 147 | <div class='online-navigation'> |
| 148 | <p></p><hr /> |
| 149 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 150 | <tr> |
| 151 | <td class='online-navigation'><a rel="prev" title="3.11.2 Retrieving source code" |
| 152 | href="inspect-source.html"><img src='../icons/previous.png' |
| 153 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 154 | <td class='online-navigation'><a rel="parent" title="3.11 inspect " |
| 155 | href="module-inspect.html"><img src='../icons/up.png' |
| 156 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 157 | <td class='online-navigation'><a rel="next" title="3.11.4 The interpreter stack" |
| 158 | href="inspect-stack.html"><img src='../icons/next.png' |
| 159 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 160 | <td align="center" width="100%">Python Library Reference</td> |
| 161 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 162 | href="contents.html"><img src='../icons/contents.png' |
| 163 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 164 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 165 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 166 | <td class='online-navigation'><a rel="index" title="Index" |
| 167 | href="genindex.html"><img src='../icons/index.png' |
| 168 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 169 | </tr></table> |
| 170 | <div class='online-navigation'> |
| 171 | <b class="navlabel">Previous:</b> |
| 172 | <a class="sectref" rel="prev" href="inspect-source.html">3.11.2 Retrieving source code</A> |
| 173 | <b class="navlabel">Up:</b> |
| 174 | <a class="sectref" rel="parent" href="module-inspect.html">3.11 inspect </A> |
| 175 | <b class="navlabel">Next:</b> |
| 176 | <a class="sectref" rel="next" href="inspect-stack.html">3.11.4 The interpreter stack</A> |
| 177 | </div> |
| 178 | </div> |
| 179 | <hr /> |
| 180 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> |
| 181 | </DIV> |
| 182 | <!--End of Navigation Panel--> |
| 183 | <ADDRESS> |
| 184 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. |
| 185 | </ADDRESS> |
| 186 | </BODY> |
| 187 | </HTML> |