param.reactive.reactive_ops.is_#

reactive_ops.is_(other) rx[source]#

Perform a logical β€œis” comparison with the given operand.

This method checks if the current object is the same object (i.e., identical in memory) as the given operand. The result is returned as a new reactive expression.

Parameters:

other (any) – The operand to compare for object identity.

Returns:

A new reactive expression representing the result of the β€œis” comparison.

Return type:

rx

Examples

Check if a reactive value refers to the same object:

>>> import param
>>> obj1 = object()
>>> obj2 = object()
>>> rx_obj = param.rx(obj1)
>>> rx_is = rx_obj.rx.is_(obj1)
>>> rx_is.rx.value
True

Compare with a different object:

>>> rx_is = rx_obj.rx.is_(obj2)
>>> rx_is.rx.value
False

Update the reactive value and re-check identity:

>>> rx_obj.rx.value = obj2
>>> rx_is.rx.value
False