Ideas for extensions of dol -- namely when we will re-architecture it #24
thorwhalen
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Include hooks
Example:
filt_iterWhat I really wish for is a way to control the way that
filter(filt, iterable)will work via the iterable.That way, when there's a different, perhaps more optimized way, to apply
filtto theiterable, we can use that.For example, say you want express your
filtto be a mongo query that will be sent to the remote DB to filter the items closer to the data. That's much less wasteful than asking for the items to be sent one by one over the wire, only to filter out most of them!But there's apparently no way to control builtin
filterfrom an iterable (that same way, for example, that you can control whatiterorlendoes, via the__iter__and__len__methods of the iterable.That said, we can control what we wrote: Namely
filt_iter. We can tell it to first see if the wrapped mapping has a_filter_method, and if so, pass the job on to it.Beta Was this translation helpful? Give feedback.
All reactions