cf.Comparison.addattr

Comparison.addattr(attr)[source]

Return a comparison object with a new left hand side operand attribute to be used during evaluation.

If another attribute has previously been specified, then the new attribute is considered to be an attribute of the existing attribute.

Parameters :
attr : str

The attribute name.

Returns :
out : cf.Comparison

The new comparison object.

Examples

>>> c = cf.eq(2001)
>>> c
<CF Comparison: (eq 2001)>
>>> c = c.addattr('year')
>>> c
<CF Comparison: year(eq 2001)>
>>> c = cf.lt(2)
>>> c = c.addattr('A')
>>> c = c.addattr('B')
>>> c
<CF Comparison: A.B(lt 2)>
>>> c = c.addattr('C')
>>> c
<CF Comparison: A.B.C(lt 2)>

Previous topic

cf.Comparison.evaluate

Next topic

cf.Comparison.copy

This Page