cf.relaxed_identities

cf.relaxed_identities(*arg)[source]

Use ‘relaxed’ mode when getting a construct identity.

If set to True, sets relaxed=True as the default in calls to a construct’s identity method (e.g. cf.Field.identity).

This is used by construct arithmetic and field construct aggregation.

Parameters

arg: bool or Constant, optional

Returns
Constant

The value prior to the change, or the current value if no new value was specified.

Examples

>>> org = cf.relaxed_identities()
>>> org
False
>>> print(cf.relaxed_identities(True))
False
>>> print(cf.relaxed_identities())
True
>>> print(cf.relaxed_identities(org))
True
>>> print(cf.relaxed_identities())
False
>>> with cf.relaxed_identities(True):
...     print(cf.relaxed_identities())
...
True
>>> print(cf.relaxed_identities())
False