holoviz / holoviz/param

Interaction between `param.rx` and `isinstance`

Open
#953 3 comments 0 reactions 0 assignees View on GitHub
status: discussion
Dominant language
Python
Stars
521
Forks
86
Avg merge
1d 13h
Merged PRs (30d)
35

Description

#### Is your feature request related to a problem? Please describe.
I couldn't find an relevant information on how to do an `isinstance` check of the inner object of the `param.rx`. Right now I have:
```python
if isinstance(field, param.rx):
if field.rx.pipe(isinstance, xarray.DataArray):
curr_data = field
```
This could work, but feels a bit clunky. It would be much nicer if `isinstance` could work without having to check if it's a `param.rx` and then use `pipe`, e.g. by creating a dynamic class that inherits the type of the first definition, or any other way to override `isinstance` checks.

#### Describe alternatives you've considered
I have of course tried if it already works, but it doesn't seem to
```python
import param
a = param.rx("string")
isinstance(a, str)
```
but this doesn't work

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.