Package genshi :: Package template :: Module eval :: Class Code

Class Code

object --+
         |
        Code
Known Subclasses:

Abstract base class for the Expression and Suite classes.
Instance Methods
 
__init__(self, source, filename=None, lineno=-1, lookup='strict', xform=None)
Create the code object, either from a string, or from an AST node.
 
__getstate__(self)
 
__setstate__(self, state)
 
__eq__(self, other)
 
__hash__(self)
hash(x)
 
__ne__(self, other)
 
__repr__(self)
repr(x)

Inherited from object: __delattr__, __format__, __getattribute__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties
  ast
  code
  source

Inherited from object: __class__

Method Details

__init__(self, source, filename=None, lineno=-1, lookup='strict', xform=None)
(Constructor)

 
Create the code object, either from a string, or from an AST node.
Parameters:
  • source - either a string containing the source code, or an AST node
  • filename - the (preferably absolute) name of the file containing the code
  • lineno - the number of the line on which the code was found
  • lookup - the lookup class that defines how variables are looked up in the context; can be either "strict" (the default), "lenient", or a custom lookup class
  • xform - the AST transformer that should be applied to the code; if None, the appropriate transformation is chosen depending on the mode
Overrides: object.__init__

__hash__(self)
(Hashing function)

 
hash(x)
Overrides: object.__hash__
(inherited documentation)

__repr__(self)
(Representation operator)

 
repr(x)
Overrides: object.__repr__
(inherited documentation)