[Subversion] / BytecodeAssembler / README.txt  

Diff of /BytecodeAssembler/README.txt

Parent Directory | Revision Log

version 2575, Tue Aug 12 18:09:37 2008 UTC version 2620, Mon Aug 2 07:06:28 2010 UTC
Line 1315 
Line 1315 
   
     >>> import inspect      >>> import inspect
   
     >>> inspect.getargspec(f1)      >>> tuple(inspect.getargspec(f1))
     (['a', 'b'], 'c', 'd', None)      (['a', 'b'], 'c', 'd', None)
   
     >>> inspect.getargspec(f2)      >>> tuple(inspect.getargspec(f2))
     (['a', 'b'], 'c', 'd', None)      (['a', 'b'], 'c', 'd', None)
   
 Note that these constructors do not copy any actual *code* from the code  Note that these constructors do not copy any actual *code* from the code
Line 1357 
Line 1357 
 unpacking process, and is designed so that the ``inspect`` module will  unpacking process, and is designed so that the ``inspect`` module will
 recognize it as an argument unpacking prologue::  recognize it as an argument unpacking prologue::
   
     >>> inspect.getargspec(f3)      >>> tuple(inspect.getargspec(f3))
     (['a', ['b', 'c'], ['d', ['e', 'f']]], None, None, None)      (['a', ['b', 'c'], ['d', ['e', 'f']]], None, None, None)
   
     >>> inspect.getargspec(f4)      >>> tuple(inspect.getargspec(f4))
     (['a', ['b', 'c'], ['d', ['e', 'f']]], None, None, None)      (['a', ['b', 'c'], ['d', ['e', 'f']]], None, None, None)
   
 You can also use the ``from_spec(name='<lambda>', args=(), var=None, kw=None)``  You can also use the ``from_spec(name='<lambda>', args=(), var=None, kw=None)``
Line 1376 
Line 1376 
     >>> c.co_argcount      >>> c.co_argcount
     3      3
   
     >>> inspect.getargs(c.code())      >>> tuple(inspect.getargs(c.code()))
     (['b', ['c', 'd'], 'e'], 'f', 'g')      (['b', ['c', 'd'], 'e'], 'f', 'g')
   
   
Line 1403 
Line 1403 
     42      42
   
     >>> import inspect      >>> import inspect
     >>> inspect.getargspec(f)      >>> tuple(inspect.getargspec(f))
     (['a', 'b', 'c'], None, None, None)      (['a', 'b', 'c'], None, None, None)
   
 Although Python code objects want ``co_varnames`` to be a tuple, ``Code``  Although Python code objects want ``co_varnames`` to be a tuple, ``Code``
Line 2111 
Line 2111 
     >>> c.co_filename      >>> c.co_filename
     'testname'      'testname'
   
     >>> inspect.getargs(c.code(p))      >>> tuple(inspect.getargs(c.code(p)))
     (['a', 'b'], 'c', 'd')      (['a', 'b'], 'c', 'd')
   
 Notice that you must pass the parent code object to the child's ``.code()``  Notice that you must pass the parent code object to the child's ``.code()``
Line 2183 
Line 2183 
     >>> f      >>> f
     <function f at ...>      <function f at ...>
   
     >>> inspect.getargspec(f)      >>> tuple(inspect.getargspec(f))
     (['a'], None, None, (42,))      (['a'], None, None, (42,))
   
     >>> f()      >>> f()
Line 2211 
Line 2211 
     >>> f      >>> f
     <function f at ...>      <function f at ...>
   
     >>> inspect.getargspec(f)      >>> tuple(inspect.getargspec(f))
     (['a', 'b'], 'c', 'd', (99, 66))      (['a', 'b'], 'c', 'd', (99, 66))
   
     >>> dis(f)      >>> dis(f)
Line 2914 
Line 2914 
     >>> from peak.util.assembler import LOAD_CONST, POP_BLOCK      >>> from peak.util.assembler import LOAD_CONST, POP_BLOCK
   
     >>> import sys      >>> import sys
     >>> WHY_CONTINUE = {'2.3':5, '2.4':32, '2.5':32}[sys.version[:3]]      >>> WHY_CONTINUE = {'2.3':5}.get(sys.version[:3], 32)
   
     >>> def Switch(expr, cases, default=Pass, code=None):      >>> def Switch(expr, cases, default=Pass, code=None):
     ...     if code is None:      ...     if code is None:


Generate output suitable for use with a patch program
Legend:
Removed from v.2575  
changed lines
  Added in v.2620

cvs-admin@eby-sarna.com

Powered by ViewCVS 1.0-dev

ViewCVS and CVS Help