From bc5fd5a2278ecc4730356b27d137bda9029664fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Thu, 27 Feb 2025 03:24:21 +0100 Subject: [PATCH] Decorator --- README.md | 2 +- index.html | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 34a553e..5e21337 100644 --- a/README.md +++ b/README.md @@ -932,7 +932,7 @@ from functools import cache def fib(n): return n if n < 2 else fib(n-2) + fib(n-1) ``` -* **Potential problem with cache is that it can grow indefinitely. To clear stored values run `'fib.cache_clear()'`, or use `'@lru_cache(maxsize=)'` decorator instead.** +* **Potential problem with cache is that it can grow indefinitely. To clear stored values run `'.cache_clear()'`, or use `'@lru_cache(maxsize=)'` decorator instead.** * **CPython interpreter limits recursion depth to 3000 by default. To increase it run `'sys.setrecursionlimit()'`.** ### Parametrized Decorator diff --git a/index.html b/index.html index 8757f5e..4858257 100644 --- a/index.html +++ b/index.html @@ -56,7 +56,7 @@
- +
@@ -789,7 +789,7 @@ player = Player(point, direction) #
    -
  • Potential problem with cache is that it can grow indefinitely. To clear stored values run 'fib.cache_clear()', or use '@lru_cache(maxsize=<int>)' decorator instead.
  • +
  • Potential problem with cache is that it can grow indefinitely. To clear stored values run '<func>.cache_clear()', or use '@lru_cache(maxsize=<int>)' decorator instead.
  • CPython interpreter limits recursion depth to 3000 by default. To increase it run 'sys.setrecursionlimit(<int>)'.

Parametrized Decorator

A decorator that accepts arguments and returns a normal decorator that accepts a function.

from functools import wraps
@@ -2942,7 +2942,7 @@ $ deactivate                # Deactivates the active