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

Class Code



object --+
         |
        Code
Known Subclasses:
Expression, Suite

Abstract base class for the Expression and Suite classes.

Instance Methods
 
__init__(self, source, filename=None, lineno=-1, lookup='lenient')
Create the code object, either from a string, or from an AST node.
 
__eq__(self, other)
 
__hash__(self)
hash(x)
 
__ne__(self, other)
 
__repr__(self)
repr(x)

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

Properties
  code
  source

Inherited from object: __class__

Method Details

__init__(self, source, filename=None, lineno=-1, lookup='lenient')
(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 LenientLookup (the default), StrictLookup, or a custom lookup class
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)