holoviz / holoviz/param

Serializing of ListProxy object as YAML

Open
#981 0 comments 2 reactions 0 assignees View on GitHub
type-bug
Dominant language
Python
Stars
521
Forks
86
Avg merge
1d 13h
Merged PRs (30d)
35

Description

Serializing as YAML the `objects` attribute of a `Selector` Parameter, which under the hood is a `ListProxy` object (from Param), doesn't serialize a standard list or dict but the custom object. I don't think this should be the default behavior? It broke the attractors code.

```python
import yaml
import param

class P(param.Parameterized):

s = param.Selector(objects=['a', 'b', 'c'])

with open('lp.yaml', 'w') as f:
yaml.dump(P.param.s.objects, f)
```

```yaml
!!python/object/new:param.parameters.ListProxy
listitems:
- a
- b
- c
state:
_parameter: !!python/object:param.parameters.Selector
_label: null
_objects:
- a
- b
- c
allow_None: null
allow_refs: false
check_on_set: true
compute_default_fn: null
constant: false
default: a
doc: null
instantiate: false
name: s
names: {}
nested_refs: false
owner: !!python/name:__main__.P ''
per_instance: true
pickle_default_value: true
precedence: null
readonly: false
watchers: {}
```

🤯

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.