Replies: 2 comments
-
@fgregg any thoughts on this? |
Beta Was this translation helpful? Give feedback.
0 replies
-
i think this is a smart idea. we implicitly rely on predicates returning unique collections and it would be good to make that explicit |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
At the momento a predicate function is defined as
PredicateFunction = Callable[[Any], Iterable[str]]
.Could we change it to
PredicateFunction = Callable[[Any], set[str]]
?If I am not wrong (but maybe I am) we actually never care about the order of the items inside the output of a predicate.
With this change in place we cold carry out a number of optimizations, e.g. in training.py this code:
would become
(The above snippet could be optimized even further if we just check if the intersection is non-empty instead of building it completely.)
Let me know!
Beta Was this translation helpful? Give feedback.
All reactions