⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bytecodes.html

📁 一本很好的python的说明书,适合对python感兴趣的人
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<dl><dt><b><tt class='opcode'>PRINT_NEWLINE</tt></b>
<dd>
Prints a new line on <code>sys.stdout</code>.  This is generated as the
last operation of a <tt class="keyword">print</tt> statement, unless the statement
ends with a comma.
</dl>

<P>
<dl><dt><b><tt class='opcode'>PRINT_NEWLINE_TO</tt></b>
<dd>
Like <code>PRINT_NEWLINE</code>, but prints the new line on the file-like
object on the TOS.  This is used by the extended print statement.
</dl>

<P>
<dl><dt><b><tt class='opcode'>BREAK_LOOP</tt></b>
<dd>
Terminates a loop due to a <tt class="keyword">break</tt> statement.
</dl>

<P>
<dl><dt><b><tt class='opcode'>LOAD_LOCALS</tt></b>
<dd>
Pushes a reference to the locals of the current scope on the stack.
This is used in the code for a class definition: After the class body
is evaluated, the locals are passed to the class definition.
</dl>

<P>
<dl><dt><b><tt class='opcode'>RETURN_VALUE</tt></b>
<dd>
Returns with TOS to the caller of the function.
</dl>

<P>
<dl><dt><b><tt class='opcode'>IMPORT_STAR</tt></b>
<dd>
Loads all symbols not starting with "<tt class="character">_</tt>" directly from the module TOS
to the local namespace. The module is popped after loading all names.
This opcode implements <code>from module import *</code>.
</dl>

<P>
<dl><dt><b><tt class='opcode'>EXEC_STMT</tt></b>
<dd>
Implements <code>exec TOS2,TOS1,TOS</code>.  The compiler fills
missing optional parameters with <code>None</code>.
</dl>

<P>
<dl><dt><b><tt class='opcode'>POP_BLOCK</tt></b>
<dd>
Removes one block from the block stack.  Per frame, there is a 
stack of blocks, denoting nested loops, try statements, and such.
</dl>

<P>
<dl><dt><b><tt class='opcode'>END_FINALLY</tt></b>
<dd>
Terminates a <tt class="keyword">finally</tt> clause.  The interpreter recalls
whether the exception has to be re-raised, or whether the function
returns, and continues with the outer-next block.
</dl>

<P>
<dl><dt><b><tt class='opcode'>BUILD_CLASS</tt></b>
<dd>
Creates a new class object.  TOS is the methods dictionary, TOS1
the tuple of the names of the base classes, and TOS2 the class name.
</dl>

<P>
All of the following opcodes expect arguments.  An argument is two
bytes, with the more significant byte last.

<P>
<dl><dt><b><tt class='opcode'>STORE_NAME</tt></b>&nbsp;&nbsp;&nbsp;&nbsp;<var>namei</var>
<dd>
Implements <code>name = TOS</code>. <var>namei</var> is the index of <var>name</var>
in the attribute <tt class="member">co_names</tt> of the code object.
The compiler tries to use <code>STORE_LOCAL</code> or <code>STORE_GLOBAL</code>
if possible.
</dl>

<P>
<dl><dt><b><tt class='opcode'>DELETE_NAME</tt></b>&nbsp;&nbsp;&nbsp;&nbsp;<var>namei</var>
<dd>
Implements <code>del name</code>, where <var>namei</var> is the index into
<tt class="member">co_names</tt> attribute of the code object.
</dl>

<P>
<dl><dt><b><tt class='opcode'>UNPACK_SEQUENCE</tt></b>&nbsp;&nbsp;&nbsp;&nbsp;<var>count</var>
<dd>
Unpacks TOS into <var>count</var> individual values, which are put onto
the stack right-to-left.
</dl>

<P>
<dl><dt><b><tt class='opcode'>DUP_TOPX</tt></b>&nbsp;&nbsp;&nbsp;&nbsp;<var>count</var>
<dd>
Duplicate <var>count</var> items, keeping them in the same order. Due to
implementation limits, <var>count</var> should be between 1 and 5 inclusive.
</dl>

<P>
<dl><dt><b><tt class='opcode'>STORE_ATTR</tt></b>&nbsp;&nbsp;&nbsp;&nbsp;<var>namei</var>
<dd>
Implements <code>TOS.name = TOS1</code>, where <var>namei</var> is the index
of name in <tt class="member">co_names</tt>.
</dl>

<P>
<dl><dt><b><tt class='opcode'>DELETE_ATTR</tt></b>&nbsp;&nbsp;&nbsp;&nbsp;<var>namei</var>
<dd>
Implements <code>del TOS.name</code>, using <var>namei</var> as index into
<tt class="member">co_names</tt>.
</dl>

<P>
<dl><dt><b><tt class='opcode'>STORE_GLOBAL</tt></b>&nbsp;&nbsp;&nbsp;&nbsp;<var>namei</var>
<dd>
Works as <code>STORE_NAME</code>, but stores the name as a global.
</dl>

<P>
<dl><dt><b><tt class='opcode'>DELETE_GLOBAL</tt></b>&nbsp;&nbsp;&nbsp;&nbsp;<var>namei</var>
<dd>
Works as <code>DELETE_NAME</code>, but deletes a global name.
</dl>

<P>
<dl><dt><b><tt class='opcode'>LOAD_CONST</tt></b>&nbsp;&nbsp;&nbsp;&nbsp;<var>consti</var>
<dd>
Pushes "<tt class="samp">co_consts[<var>consti</var>]</tt>" onto the stack.
</dl>

<P>
<dl><dt><b><tt class='opcode'>LOAD_NAME</tt></b>&nbsp;&nbsp;&nbsp;&nbsp;<var>namei</var>
<dd>
Pushes the value associated with "<tt class="samp">co_names[<var>namei</var>]</tt>" onto the stack.
</dl>

<P>
<dl><dt><b><tt class='opcode'>BUILD_TUPLE</tt></b>&nbsp;&nbsp;&nbsp;&nbsp;<var>count</var>
<dd>
Creates a tuple consuming <var>count</var> items from the stack, and pushes
the resulting tuple onto the stack.
</dl>

<P>
<dl><dt><b><tt class='opcode'>BUILD_LIST</tt></b>&nbsp;&nbsp;&nbsp;&nbsp;<var>count</var>
<dd>
Works as <code>BUILD_TUPLE</code>, but creates a list.
</dl>

<P>
<dl><dt><b><tt class='opcode'>BUILD_MAP</tt></b>&nbsp;&nbsp;&nbsp;&nbsp;<var>zero</var>
<dd>
Pushes a new empty dictionary object onto the stack.  The argument is
ignored and set to zero by the compiler.
</dl>

<P>
<dl><dt><b><tt class='opcode'>LOAD_ATTR</tt></b>&nbsp;&nbsp;&nbsp;&nbsp;<var>namei</var>
<dd>
Replaces TOS with <code>getattr(TOS, co_names[<var>namei</var>]</code>.
</dl>

<P>
<dl><dt><b><tt class='opcode'>COMPARE_OP</tt></b>&nbsp;&nbsp;&nbsp;&nbsp;<var>opname</var>
<dd>
Performs a boolean operation.  The operation name can be found
in <code>cmp_op[<var>opname</var>]</code>.
</dl>

<P>
<dl><dt><b><tt class='opcode'>IMPORT_NAME</tt></b>&nbsp;&nbsp;&nbsp;&nbsp;<var>namei</var>
<dd>
Imports the module <code>co_names[<var>namei</var>]</code>.  The module object is
pushed onto the stack.  The current namespace is not affected: for a
proper import statement, a subsequent <code>STORE_FAST</code> instruction
modifies the namespace.
</dl>

<P>
<dl><dt><b><tt class='opcode'>IMPORT_FROM</tt></b>&nbsp;&nbsp;&nbsp;&nbsp;<var>namei</var>
<dd>
Loads the attribute <code>co_names[<var>namei</var>]</code> from the module found in
TOS. The resulting object is pushed onto the stack, to be subsequently
stored by a <code>STORE_FAST</code> instruction.
</dl>

<P>
<dl><dt><b><tt class='opcode'>JUMP_FORWARD</tt></b>&nbsp;&nbsp;&nbsp;&nbsp;<var>delta</var>
<dd>
Increments byte code counter by <var>delta</var>.
</dl>

<P>
<dl><dt><b><tt class='opcode'>JUMP_IF_TRUE</tt></b>&nbsp;&nbsp;&nbsp;&nbsp;<var>delta</var>
<dd>
If TOS is true, increment the byte code counter by <var>delta</var>.  TOS is
left on the stack.
</dl>

<P>
<dl><dt><b><tt class='opcode'>JUMP_IF_FALSE</tt></b>&nbsp;&nbsp;&nbsp;&nbsp;<var>delta</var>
<dd>
If TOS is false, increment the byte code counter by <var>delta</var>.  TOS
is not changed. 
</dl>

<P>
<dl><dt><b><tt class='opcode'>JUMP_ABSOLUTE</tt></b>&nbsp;&nbsp;&nbsp;&nbsp;<var>target</var>
<dd>
Set byte code counter to <var>target</var>.
</dl>

<P>
<dl><dt><b><tt class='opcode'>FOR_LOOP</tt></b>&nbsp;&nbsp;&nbsp;&nbsp;<var>delta</var>
<dd>
Iterate over a sequence.  TOS is the current index, TOS1 the sequence.
First, the next element is computed.  If the sequence is exhausted,
increment byte code counter by <var>delta</var>.  Otherwise, push the
sequence, the incremented counter, and the current item onto the stack.
</dl>

<P>
<dl><dt><b><tt class='opcode'>LOAD_GLOBAL</tt></b>&nbsp;&nbsp;&nbsp;&nbsp;<var>namei</var>
<dd>
Loads the global named <code>co_names[<var>namei</var>]</code> onto the stack.
</dl>

<P>
<dl><dt><b><tt class='opcode'>SETUP_LOOP</tt></b>&nbsp;&nbsp;&nbsp;&nbsp;<var>delta</var>
<dd>
Pushes a block for a loop onto the block stack.  The block spans
from the current instruction with a size of <var>delta</var> bytes.
</dl>

<P>
<dl><dt><b><tt class='opcode'>SETUP_EXCEPT</tt></b>&nbsp;&nbsp;&nbsp;&nbsp;<var>delta</var>
<dd>
Pushes a try block from a try-except clause onto the block stack.
<var>delta</var> points to the first except block.
</dl>

<P>
<dl><dt><b><tt class='opcode'>SETUP_FINALLY</tt></b>&nbsp;&nbsp;&nbsp;&nbsp;<var>delta</var>
<dd>
Pushes a try block from a try-except clause onto the block stack.
<var>delta</var> points to the finally block.
</dl>

<P>
<dl><dt><b><tt class='opcode'>LOAD_FAST</tt></b>&nbsp;&nbsp;&nbsp;&nbsp;<var>var_num</var>
<dd>
Pushes a reference to the local <code>co_varnames[<var>var_num</var>]</code> onto
the stack.
</dl>

<P>
<dl><dt><b><tt class='opcode'>STORE_FAST</tt></b>&nbsp;&nbsp;&nbsp;&nbsp;<var>var_num</var>
<dd>
Stores TOS into the local <code>co_varnames[<var>var_num</var>]</code>.
</dl>

<P>
<dl><dt><b><tt class='opcode'>DELETE_FAST</tt></b>&nbsp;&nbsp;&nbsp;&nbsp;<var>var_num</var>
<dd>
Deletes local <code>co_varnames[<var>var_num</var>]</code>.
</dl>

<P>
<dl><dt><b><tt class='opcode'>SET_LINENO</tt></b>&nbsp;&nbsp;&nbsp;&nbsp;<var>lineno</var>
<dd>
Sets the current line number to <var>lineno</var>.
</dl>

<P>
<dl><dt><b><tt class='opcode'>RAISE_VARARGS</tt></b>&nbsp;&nbsp;&nbsp;&nbsp;<var>argc</var>
<dd>
Raises an exception. <var>argc</var> indicates the number of parameters
to the raise statement, ranging from 0 to 3.  The handler will find
the traceback as TOS2, the parameter as TOS1, and the exception
as TOS.
</dl>

<P>
<dl><dt><b><tt class='opcode'>CALL_FUNCTION</tt></b>&nbsp;&nbsp;&nbsp;&nbsp;<var>argc</var>
<dd>
Calls a function.  The low byte of <var>argc</var> indicates the number of
positional parameters, the high byte the number of keyword parameters.
On the stack, the opcode finds the keyword parameters first.  For each
keyword argument, the value is on top of the key.  Below the keyword
parameters, the positional parameters are on the stack, with the
right-most parameter on top.  Below the parameters, the function object
to call is on the stack.
</dl>

<P>
<dl><dt><b><tt class='opcode'>MAKE_FUNCTION</tt></b>&nbsp;&nbsp;&nbsp;&nbsp;<var>argc</var>
<dd>
Pushes a new function object on the stack.  TOS is the code associated
with the function.  The function object is defined to have <var>argc</var>
default parameters, which are found below TOS.
</dl>

<P>
<dl><dt><b><tt class='opcode'>BUILD_SLICE</tt></b>&nbsp;&nbsp;&nbsp;&nbsp;<var>argc</var>
<dd>
Pushes a slice object on the stack.  <var>argc</var> must be 2 or 3.  If it
is 2, <code>slice(TOS1, TOS)</code> is pushed; if it is 3,
<code>slice(TOS2, TOS1, TOS)</code> is pushed.
See the <code>slice()</code> built-in function for more
information.
</dl>

<P>
<dl><dt><b><tt class='opcode'>EXTENDED_ARG</tt></b>&nbsp;&nbsp;&nbsp;&nbsp;<var>ext</var>
<dd>
Prefixes any opcode which has an argument too big to fit into the
default two bytes.  <var>ext</var> holds two additional bytes which, taken
together with the subsequent opcode's argument, comprise a four-byte
argument, <var>ext</var> being the two most-significant bytes.
</dl>

<P>
<dl><dt><b><tt class='opcode'>CALL_FUNCTION_VAR</tt></b>&nbsp;&nbsp;&nbsp;&nbsp;<var>argc</var>
<dd>
Calls a function. <var>argc</var> is interpreted as in <code>CALL_FUNCTION</code>.
The top element on the stack contains the variable argument list, followed
by keyword and positional arguments.
</dl>

<P>
<dl><dt><b><tt class='opcode'>CALL_FUNCTION_KW</tt></b>&nbsp;&nbsp;&nbsp;&nbsp;<var>argc</var>
<dd>
Calls a function. <var>argc</var> is interpreted as in <code>CALL_FUNCTION</code>.
The top element on the stack contains the keyword arguments dictionary, 
followed by explicit keyword and positional arguments.
</dl>

<P>
<dl><dt><b><tt class='opcode'>CALL_FUNCTION_VAR_KW</tt></b>&nbsp;&nbsp;&nbsp;&nbsp;<var>argc</var>
<dd>
Calls a function. <var>argc</var> is interpreted as in
<code>CALL_FUNCTION</code>.  The top element on the stack contains the
keyword arguments dictionary, followed by the variable-arguments
tuple, followed by explicit keyword and positional arguments.
</dl>

<P>

<DIV CLASS="navigation"><p><hr><table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><A href="module-dis.html" tppabs="http://www.python.org/doc/current/lib/module-dis.html"><img src="previous.gif" tppabs="http://www.python.org/doc/current/icons/previous.gif" border="0" height="32"
  alt="Previous Page" width="32"></A></td>
<td><A href="module-dis.html" tppabs="http://www.python.org/doc/current/lib/module-dis.html"><img src="up.gif" tppabs="http://www.python.org/doc/current/icons/up.gif" border="0" height="32"
  alt="Up One Level" width="32"></A></td>
<td><A href="sgi.html" tppabs="http://www.python.org/doc/current/lib/sgi.html"><img src="next.gif" tppabs="http://www.python.org/doc/current/icons/next.gif" border="0" height="32"
  alt="Next Page" width="32"></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td><A href="contents.html" tppabs="http://www.python.org/doc/current/lib/contents.html"><img src="contents.gif" tppabs="http://www.python.org/doc/current/icons/contents.gif" border="0" height="32"
  alt="Contents" width="32"></A></td>
<td><a href="modindex.html" tppabs="http://www.python.org/doc/current/lib/modindex.html" title="Module Index"><img src="modules.gif" tppabs="http://www.python.org/doc/current/icons/modules.gif" border="0" height="32"
  alt="Module Index" width="32"></a></td>
<td><A href="genindex.html" tppabs="http://www.python.org/doc/current/lib/genindex.html"><img src="index.gif" tppabs="http://www.python.org/doc/current/icons/index.gif" border="0" height="32"
  alt="Index" width="32"></A></td>
</tr></table>
<b class="navlabel">Previous:</b> <a class="sectref" href="module-dis.html" tppabs="http://www.python.org/doc/current/lib/module-dis.html">17.10 dis  </A>
<b class="navlabel">Up:</b> <a class="sectref" href="module-dis.html" tppabs="http://www.python.org/doc/current/lib/module-dis.html">17.10 dis  </A>
<b class="navlabel">Next:</b> <a class="sectref" href="sgi.html" tppabs="http://www.python.org/doc/current/lib/sgi.html">18. SGI IRIX Specific</A>
</DIV>
<!--End of Navigation Panel-->
<ADDRESS>
<hr>See <i><a href="about.html" tppabs="http://www.python.org/doc/current/lib/about.html">About this document...</a></i> for information on suggesting changes.
</ADDRESS>
</BODY>
</HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -