Paste: python lexical variables

Author: ks
Mode: text
Date: Fri, 13 May 2011 19:36:19
Plain Text |
Python 2.6.6 (r266:84292, Jan  8 2011, 16:51:24) 
[GCC 4.2.1 (Apple Inc. build 5664)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 
>>> def makeAdder(x) :
...     return lambda y : x + y
... 
>>> add10 = makeAdder(10)
>>> 
>>> import dis
>>> dis.dis(add10)
  2           0 LOAD_DEREF               0 (x)
              3 LOAD_FAST                0 (y)
              6 BINARY_ADD          
              7 RETURN_VALUE        
>>> 

New Annotation

Summary:
Author:
Mode:
Body: