-
Notifications
You must be signed in to change notification settings - Fork 795
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve expr
method signatures
#3563
Comments
I like it! Sounds like a big UX improvement for the Python-side of the expression syntax. And I also don't see any drawback to this, defining invalid expressions could still be done by just skipping the |
I also think it would be great to have better error messages from expressions, thanks for exploring this! Directly to your comment about using |
@mattijn @jonmmease do you guys have any thoughts on this idea? (providing everyone was onboard) |
I believe the Vega Expressions syntax is a powerful asset of the grammar that remains under-utilised. I'm very supportive with any attempt to improve it, such as your suggestion here to introduce positional-only arguments. However, if a broader overhaul is needed to improve the ergonomics, making it more accessible and pythonic, I am also in favour. And to improve this properly I think this requires a major version bump, and it would be great to have one. So yeah, good idea, but if your brain can see further, also great!😊 |
Exciting! I like the idea of trying to get to a v6. That would allow us to work on these: https://github.com/vega/altair/issues?q=is%3Aopen+is%3Aissue+label%3Av6 Especially, #2918 could be of big help for users. |
Problem
While I was working on #3544, I tried out re-writing some expression strings to use
alt.expr
.This idea stems from what I saw as a poor UX - that has a relatively simple solution with multiple benefits.
Related
Minimal Repro
Based on a681ec5
Code block
Visual Feedback
Screenshot
expr
Solution
Replacing the
alt.expr
classmethod(s)*args
parameter with named positional-only parameter(s).Benefits
TypeError
at the time ofexpr
definitionChartType
python
and notjavascript
expr
and the missing argument""
for theelseValue
Example (
alt.expr.if_
)Although there are a large number of signatures to be updated, the process for each should be as simple as refering to the docstring or Vega Expressions
Drawbacks
The only downside I can see - hypothetically - is if there is a utility in having invalid expressions at
expr
definition time?Maybe there is some use-case here I'm unaware of, but it seems unlikely to me it could outweigh the traceback improvement
The text was updated successfully, but these errors were encountered: