Comments (3)
When per_instance=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 separate Parameter objects would be seen as a bug and not expected behavior. I.e., if the user wanted independent Parameter objects, they will want independent containers, because if they wanted them all to share the same values they wouldn't have used per_instance
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.
I've corrected my message above to say per_instance
where I had written instantiate
; I always get those two confused. per_instance
is the relevant one here, which controls instantiation of the Parameter object per instance, not instantiation of the default value into a current value (instantiate=True
).
from param.
Related Issues (20)
- Default range of param.Range fails to update using self.param.<parameter>.default assignment HOT 4
- Ability to apply @param.depends to all (nested) Parameters of a class HOT 1
- Param with bounds should default to lower bound HOT 7
- Add .is_active parameter to reactive expressions HOT 3
- Let reactive expressions .watch method support async functions
- Context manager .param.update should restore references
- Let pn.Param accept a list of objects HOT 1
- Warn on errors thru rx updates
- Make param.depends efficient HOT 6
- Parameter called outputs does not work with `.rx` HOT 4
- Triggering a function in one instance based on parameter changes in another HOT 2
- Initialization changes constant attribute. HOT 3
- Missing `param_help.png` in `User Guide/Parameters`
- Discussion about the intro video HOT 1
- Should methods on Parameterizeds be treated as references by default HOT 3
- `name` of a Parameterized instance overridden when is the default of a `readonly/constant` Parameter HOT 2
- Error on printing rx
- RX: output not updated when indexing a DataFrame with value_start/value_end HOT 1
- Small text issue in doc Getting Started
- Ability to specify multiple classes in class_ for ClassSelector parameter type needs to be documented
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.