Package transf :: Module context :: Class Context
[frames] | no frames]

Class Context




Transformation context.

Contexts are nested dictionaries of named variables. During variable lookup, variables not found in the local scope are search recursively in the ancestor contexts.

Instance Methods
 
__init__(self, vars=(), parent=None)
Create a new context.
 
set(self, name, value)
Set the variable with this name.
 
__setitem__(self, name, value)
Set the variable with this name.
 
get(self, name)
Lookup the variable with this name.
 
__getitem__(self, name)
Lookup the variable with this name.
 
iter(self)
Iterate over all variables defined in this context.
 
__iter__(self)
Iterate over all variables defined in this context.
 
__repr__(self)
repr(x)

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

Properties

Inherited from object: __class__

Method Details

__init__(self, vars=(), parent=None)
(Constructor)

 
Create a new context.
Parameters:
  • vars - a sequence/iterator of (name, variable) pairs.
  • parent - optional parent context.
Overrides: object.__init__

__repr__(self)
(Representation operator)

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