Closed erpadmin closed 5 years ago
Yes. It shows that, no?
You get the type-name and event-info, and need to return a boolean (hence, a predicate).
I think that, at the very least, the fact that the filter_predicate
is used to shortcut all event processing should be documented in a detailed docstring for event_gen()
. Something like what I had to search out in release notes:
Can now provide
filter_predicate
to event_gen() to allow custom loop termination based on events.
I was burned by this yesterday, because I naively assumed that filter_predicate
was a way to select which events I wanted to handle, like the Python built-in filter()
. It was also necessary to go digging deep in the event_gen()
code to find the expected signature of the predicate, not ideal for someone who just wants to use this as a library.
Inotify class function event_gen excerpt:
its expecting it to be callable?