holoviz / holoviz/param

set_dynamic_time_fn() does not set dynamic time_fn

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

Description

#### ALL software version info
param 1.12.2

#### Description of expected behavior and the observed behavior
From the [API reference](https://param.holoviz.org/reference.html):

> set_dynamic_time_fn(time_fn, sublistattr=None)[[source]](https://param.holoviz.org/_modules/param/parameterized.html#Parameters.set_dynamic_time_fn)
Set time_fn for all Dynamic Parameters of this class or instance object that are currently being dynamically generated.

Either I am completely misunderstanding this/using it wrong, or it just doesn't do that. The time_fn is unaffected.

> Additionally, sets _Dynamic_time_fn=time_fn on this class or instance object, ...

This is true.

> ... so that any future changes to Dynamic Parmeters can inherit time_fn (e.g. if a Number is changed from a float to a number generator, the number generator will inherit time_fn).

But this is not.

#### Complete, minimal, self-contained example code that reproduces the issue

```
import param
import numbergen as ng

class Foo(param.Parameterized):
a = param.Dynamic()

print(Foo.param.a.time_fn)

foo = Foo()
print(foo.param.a.time_fn)

time = param.Time()
print(time)

Foo.param.set_dynamic_time_fn(time)
print(Foo.param.a.time_fn) # This has not changed

foo.param.set_dynamic_time_fn(time)
print(foo.param.a.time_fn) # This has not changed

print(Foo._Dynamic_time_fn) # This did get set
foo2 = Foo()
print(foo2.param.a.time_fn) # But was not set on the new instance parameter
foo2.a = ng.UniformRandom()
print(foo2.param.a.time_fn) # Nor set on change
```
```

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.