Class LenientLookup
object --+
|
LookupBase --+
|
LenientLookup
Default variable lookup mechanism for expressions.
When an undefined variable is referenced using this lookup style, the
reference evaluates to an instance of the Undefined class:
>>> expr = Expression('nothing', lookup='lenient')
>>> undef = expr.evaluate({})
>>> undef
<Undefined 'nothing'>
The same will happen when a non-existing attribute or item is accessed on
an existing object:
>>> expr = Expression('something.nil', lookup='lenient')
>>> expr.evaluate({'something': dict()})
<Undefined 'nil'>
See the documentation of the Undefined class for details on the behavior
of such objects.
|
Inherited from object:
__delattr__,
__getattribute__,
__hash__,
__init__,
__new__,
__reduce__,
__reduce_ex__,
__repr__,
__setattr__,
__str__
|
|
|
undefined(cls,
key,
owner=UNDEFINED)
Return an Undefined object. |
|
|
|
Inherited from LookupBase:
globals,
lookup_attr,
lookup_item,
lookup_name
|
|
Inherited from object:
__class__
|
undefined(cls,
key,
owner=UNDEFINED)
Class Method
|
|
Return an Undefined object.
- Parameters:
key - the name of the variable
owner - the owning object, if the variable is accessed as a member
- Overrides:
LookupBase.undefined
|