param.reactive.reactive_ops.bool#

reactive_ops.bool() rx[source]#

Evaluate the truthiness of the current object.

This method computes the boolean value of the current reactive expression. The result is returned as a new reactive expression, allowing the truthiness of the object to be used in further reactive operations.

Returns:

A new reactive expression representing the boolean value of the object.

Return type:

rx

Examples

Create a reactive expression and evaluate its truthiness:

>>> import param
>>> rx_value = param.rx(5)
>>> rx_bool = rx_value.rx.bool()
>>> rx_bool.rx.value
True

Evaluate the truthiness of an empty reactive expression:

>>> rx_empty = param.rx([])
>>> rx_bool = rx_empty.rx.bool()
>>> rx_bool.rx.value
False