Prepare repository for merge

This commit is contained in:
Angelos Chalaris
2023-05-01 22:43:50 +03:00
parent ab1ea476c5
commit a5ca5190e5
169 changed files with 0 additions and 626 deletions

23
python/snippets/delay.md Normal file
View File

@ -0,0 +1,23 @@
---
title: Delayed function execution
type: snippet
tags: [function]
cover: succulent-10
dateModified: 2020-11-02T19:27:53+02:00
---
Invokes the provided function after `ms` milliseconds.
- Use `time.sleep()` to delay the execution of `fn` by `ms / 1000` seconds.
```py
from time import sleep
def delay(fn, ms, *args):
sleep(ms / 1000)
return fn(*args)
```
```py
delay(lambda x: print(x), 1000, 'later') # prints 'later' after one second
```