Open
Description
Inspired by pydata/xarray#8658 (comment): you can't currently filter a consumes(bundle)
strategy, which would be useful:
consumes(bundle).filter(fn)
basically works, but the retries inFilteredStrategy.do_draw()
mean that you're likely to consume more elements from the bundle than intended. That's semantically OK - maybe we just chose never to refer to them again later - but can be a performance hit if acceptable elements are rare, and you're already missing the filtering-sampled_from fast path.consumes(bundle.filter(fn))
is disallowed by the types involved, but not for any especially principled reason.
So... let's just fix that! A BundleReferenceStrategy
is practically a SampledFromStrategy
already, so I propose that we make Bundle
a subclass of SampledFromStrategy
. That would give us automatic support for both cases above, as well as all the nice logic for efficient handling of filter (and map) transforms, unique collections, and so on.
(we might as well inline BundleReferenceStrategy
into Bundle
while we're at it; there's no real reason to have it separate)