Comments (3)
When instantiate=True leads to copying the Parameter object, can we make it do a copy (not a deepcopy) of any mutable slot values (or all slot values, which should have the same result)? That seems cheap enough and preserves object identity for the items in the Selector while avoiding this problem.
The only mutable types I can see in slot values are all containers (_objects
and names
here, plus attribs
for Composite, columns
potentially on DataFrame, and search_paths
on Path), so maybe we could shallow copy only containers, since arbitrary class instances aren't necessarily safe to copy if some Parameter did have a slot with such an item. For current Parameter types I think shallow copying everything, all mutable values, and containers would have the same result, so it may not matter much.
I'm pretty sure that for all those cases, sharing the contents of the container across instantiated Parameter objects would be seen as a bug and not expected behavior. I.e., if the user wanted that Parameter instantiated, they will want independent containers, because if they wanted them all to share the same values they wouldn't have instantiated the parameters.
from param.
When instantiate=True leads to copying the Parameter object, can we make it do a copy (not a deepcopy) of any mutable slot values (or all slot values, which should have the same result)?
Yes there's nothing that prevents us from doing that when instantiate=True
. However that doesn't resolve neither this issue nor #746 as they deal with the Selector
Parameter which is set by default with instantiate=False
, right?
from param.
Related Issues (20)
- watcher doesn't work with __len__
- Easier subclassing of Parameter HOT 5
- Warnings not displaying the right frame
- Pickle Serialization doesn't work for param.Parameterized with @param.depends function decorators HOT 2
- Cloudpickle compatibility HOT 3
- Subclassing a Parameterized class and changing the class parameters of list / dict does not work
- Callback called before a method that is depended upon
- Depending on the method of a sub parameter object is broken
- Fate of `name`? HOT 2
- Callbacks not triggered when value updated at the class level before being set on an instance HOT 2
- Add API to access watchers HOT 1
- Support async `on_init` methods
- param.pprint breaks if HoloViews is imported HOT 5
- Add official support to pathlib.Path objects to param.Path
- Deprecate `Path.search_paths`
- Add `param.watch` function/decorator HOT 1
- `ListSelector`: regression when `check_on_set=False` HOT 2
- Automatically serialize dataclass / pydantic models into `param.Parameterized`? HOT 1
- Setting a `Parameter` value in `__init__` before calling `super().__init__` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from param.