Comments (7)
I'm not sure. What should this default to?
class Test(param.Parameterized):
fps = param.Integer(bounds=(None, -1))
from param.
I don't think most people would have a strong expectation about what the default would be in either of those cases, so I'd recommend to users that they specify the default explicitly for clarity.
Still, having defaults be automatic is convenient, especially in a notebook context for quick exploratory mini-apps. My gut preference would be to take the midpoint of the two bounds (as the "most typical" value), or if there's only one specified, take that one. But I believe the current practice is to take the lower bound (alas!), so I guess taking the lower bound (if present) and then falling back to the upper bound (if present) is the best we could do.
All that's to say is that I don't object to this proposal, but I also wouldn't mind if other people want to mark it wontfix
.
from param.
If it's marked as wontfix I think it should not default to 0 outside the bounds of fps.
from param.
If I could choose I'd prefer Param not to set any default values at all, for all Parameters, so I'm not going to advocate for automatically computing smart default values 🙃
But if you want to go down that route, you'll have to define how this new logic behaves in a class inheritance scenario:
import param
class A(param.Parameterized):
fps = param.Integer(bounds=(1, None))
class B(A):
fps = param.Integer(bounds=(10, 20))
a = A()
b = B()
print(a.fps, b.fps) # ?
from param.
My first instinct is 1 and 10, but I don't mind it being wontfix, as long as the default is None (right now it's 0 if I recall).
from param.
My first instinct is 1 and 10, but I don't mind it being wontfix, as long as the default is None (right now it's 0 if I recall).
In principle I'm in full agreement but in practice this is a extremely difficult change to make because many users may implicitly be depending on the default being there.
from param.
Maybe the most conservative approach is to raise an explicit error when the computed default is invalid for the range, telling the user they need to set an appropriate default.
from param.
Related Issues (20)
- 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
- Cannot use param.Parameterized inheritance when inheriting alongside abstract classes
- Getting a "'_thread.RLock'" object error when instantiating a LangChain model as a default object
- 2 tests fail
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.