-
-
Notifications
You must be signed in to change notification settings - Fork 842
Better access to logical operand predicates #695
Description
Vega-Lite has a number of logical operands; e.g.
alt.LogicalAndPredicatealt.LogicalOrPredicatealt.LogicalNotPredicate
These come up, for example, in constructing filter transforms. It would be useful to make these available to Altair users via Python's logical operators, &, |, and ~, respectively.
There are two challenges:
-
How to implement them effectively... maybe create some sort of
PredicateMixinfor these classes? If we were constructing the wrapper classes by hand, it would make sense foralt.Predicateto be the base class of each of these logical predicates... perhaps we should change the code generation framework so that this kind of class hierarchy is (optionally) inferred in generated classes? Sounds hard to do well in a general way, though. -
The interaction with selection operands (e.g.
alt.SelectionOr,alt.SelectionAnd,alt.SelectionNot, andalt.NamedSelection) makes this a bit tricky, becauseNamedSelectionobjects serve two purposes in Altair (they act both as aalt.SelectionDefand aalt.SelectionPredicatedepending on the context).