Maybe @thomas and I will still need to duke it out, but here’s my suggestion for addition to the filter section:
The filter function is called at the point of execution of the
lazy importorlazy from importstatement, not at the point of reification. The filter function may be called concurrently.
There’s still the performance impact of the filter function to address. I’m assuming that if there is no filter function (likely the common case), there’s a fast short-circuit. If so, it begs the question of how to unset the filter function, and I assume that calling set_lazy_imports_filter(None) will do that. It might be worth mentioning in the PEP, but it’s definitely worth mentioning in any future documentation.