decorators
timer ¶
timer(r: int | None = 2, sink: Callable = sys.stdout.write, show_args: bool = False, serialize: bool = False, sep=' | ')
A decorator that displays the time taken for a function to execute.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r |
int
|
Number of decimal places to round the time to. Defaults to 2. |
2
|
sink |
Callable
|
A function that takes a string and does something with it. Defaults to print. |
write
|
show_args |
bool
|
Whether to show the arguments passed to the function. Defaults to False. |
False
|
serialize |
bool
|
Whether to serialize the output as JSON. Defaults to False. |
False
|
sep |
str
|
Separator between the function/method name and the arguments. Defaults to " | ". |
' | '
|