Ideas for extensions of dol -- namely when we will re-architecture it #24
Replies: 1 comment
|
Update from the #86/Option G design study (doc, PR #88): the "include hooks" idea here got a precise shape and a precise limit. The interface-spec mechanism prototyped there (per-method declarations of where keys/values appear, compiled at wrap time) is a natural registry for fast-op hooks: a spec is exactly the place where "this backend has a native The limit, established while attacking the design: pushdown is wrapper knowledge flowing down, which is not expressible as argument/return mapping — and |
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.All reactions