holoviz / holoviz/param

Getting to the dynamic value generator of a Dynamic parameter

Open
#66 1 comment 0 reactions 0 assignees View on GitHub
component: dynamic values status: discussion type-feature
Dominant language
Python
Stars
521
Forks
86
Avg merge
1d 13h
Merged PRs (30d)
35

Description

One thing that has frequently aggravates me about param is that there is no way (that I know of) to get at a dynamic value generator e.g a numbergen object. Perhaps there is a proper way to do this, but I have hacked in this method into my copy of param (on the Dynamic class) for the time being:

``` python
def get_generator(self, obj):
"""
Given a parameterized object, gets the dynamic value generator.
"""
return super(Dynamic,self).__get__(obj, obj.__class__)
```

This is still awkward to use, but better than nothing. Say I have an `imagen.Gaussian` object and I want to fiddle the random number generator used for the orientation. Now I can do:

``` python
generator = gaussian.params('orientation').get_generator(gaussian)
```

Now for instance, I could change the `time_fn` for this numbergen object.

Any thoughts? Is there already a better way of doing this?

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.