* **Potential problem with cache is that it can grow indefinitely. To clear its 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 return values run `'fib.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
@ -1055,9 +1055,9 @@ class <class_name>:
* **For attributes of arbitrary type use `'typing.Any'`.**
Point = make_dataclass('Point', [('x', float), ('y', float)])
Point = make_dataclass('Point', [('x', float, 0), ('y', float, 0)])
```
### Property
@ -1293,7 +1293,7 @@ class MySequence:
```
#### Discrepancies between glossary definitions and abstract base classes:
* **Glossary on Python's website defines iterable as any object with iter() or getitem() and sequence as any object with getitem() and len(). It does not define collection.**
* **Python's glossary defines iterable as any object with iter() or getitem() and sequence as any object with getitem() and len(). It does not define collection.**
* **Passing ABC Iterable to isinstance() or issubclass() checks whether object/class has method iter(), while ABC Collection checks for iter(), contains() and len().**
@ -778,7 +778,7 @@ player = Player(point, direction) <span class="hljs-comment">#
<ul>
<li><strong>Potential problem with cache is that it can grow indefinitely. To clear its stored values run <codeclass="python hljs"><spanclass="hljs-string">'fib.cache_clear()'</span></code>, or use <codeclass="python hljs"><spanclass="hljs-string">'@lru_cache(maxsize=<int>)'</span></code> decorator instead.</strong></li>
<li><strong>Potential problem with cache is that it can grow indefinitely. To clear stored return values run <codeclass="python hljs"><spanclass="hljs-string">'fib.cache_clear()'</span></code>, or use <codeclass="python hljs"><spanclass="hljs-string">'@lru_cache(maxsize=<int>)'</span></code> decorator instead.</strong></li>
<li><strong>CPython interpreter limits recursion depth to 3000 by default. To increase it run <codeclass="python hljs"><spanclass="hljs-string">'sys.setrecursionlimit(<int>)'</span></code>.</strong></li>
</ul>
<div><h3id="parametrizeddecorator">Parametrized Decorator</h3><p><strong>A decorator that accepts arguments and returns a normal decorator that accepts a function.</strong></p><pre><codeclass="python language-python hljs"><spanclass="hljs-keyword">from</span> functools <spanclass="hljs-keyword">import</span> wraps
@ -886,9 +886,10 @@ Z = dataclasses.make_dataclass(<span class="hljs-string">'Z'</span>, [<span clas
<li><strong>Function field() is needed because <codeclass="python hljs"><spanclass="hljs-string">'<attr_name>: list = []'</span></code> would make a list that is shared among all instances. Its 'default_factory' argument can be any <ahref="#callable">callable</a>.</strong></li>
<li><strong>For attributes of arbitrary type use <codeclass="python hljs"><spanclass="hljs-string">'typing.Any'</span></code>.</strong></li>
Point = make_dataclass(<spanclass="hljs-string">'Point'</span>, [(<spanclass="hljs-string">'x'</span>, float), (<spanclass="hljs-string">'y'</span>, float)])
Point = make_dataclass(<spanclass="hljs-string">'Point'</span>, [(<spanclass="hljs-string">'x'</span>, float, <spanclass="hljs-number">0</span>), (<spanclass="hljs-string">'y'</span>, float, <spanclass="hljs-number">0</span>)])
</code></pre>
<div><h3id="property">Property</h3><p><strong>Pythonic way of implementing getters and setters.</strong></p><pre><codeclass="python language-python hljs"><spanclass="hljs-class"><spanclass="hljs-keyword">class</span><spanclass="hljs-title">Person</span>:</span>
<div><h4id="discrepanciesbetweenglossarydefinitionsandabstractbaseclasses">Discrepancies between glossary definitions and abstract base classes:</h4><ul>
<li><strong>Glossary on Python's website defines iterable as any object with iter() or getitem() and sequence as any object with getitem() and len(). It does not define collection.</strong></li>
<li><strong>Python's glossary defines iterable as any object with iter() or getitem() and sequence as any object with getitem() and len(). It does not define collection.</strong></li>
<li><strong>Passing ABC Iterable to isinstance() or issubclass() checks whether object/class has method iter(), while ABC Collection checks for iter(), contains() and len().</strong></li>
</ul></div>
@ -2923,7 +2924,7 @@ $ deactivate <span class="hljs-comment"># Deactivates the active