I think it's a common pattern to first run a function unconditionally, then re-run every time a file changes (e.g. a live web server that refreshes when code changes).
You can do this:
foo()
for _ in watchfiles.watch(file):
foo()
The issue with this is, changes that happen during the first run won't be registered. Currently there isn't a nice way to express this pattern.
Suggestion: Add this option
def watch(..., yield_on_start: bool):
with RustNotify(...):
if yield_on_start:
yield set()
while True:
... # remaining code
I think it's a common pattern to first run a function unconditionally, then re-run every time a file changes (e.g. a live web server that refreshes when code changes).
You can do this:
The issue with this is, changes that happen during the first run won't be registered. Currently there isn't a nice way to express this pattern.
Suggestion: Add this option