Browse Source

Decorator

pull/46/head
Jure Šorn 4 years ago
parent
commit
25b59f9432
2 changed files with 4 additions and 5 deletions
  1. 5
      README.md
  2. 4
      index.html

5
README.md

@ -601,7 +601,7 @@ from dateutil.tz import UTC, tzlocal, gettz, resolve_imaginary
``` ```
* **Use `'<D/DT>.weekday()'` to get the day of the week (Mon == 0).** * **Use `'<D/DT>.weekday()'` to get the day of the week (Mon == 0).**
* **`'fold=1'` means second pass in case of time jumping back for one hour.** * **`'fold=1'` means second pass in case of time jumping back for one hour.**
* **`'<DT> = resolve_imaginary(<DT>)'` fixes DTs that fall into missing hour.**
* **`'<DTa> = resolve_imaginary(<DTa>)'` fixes DTs that fall into missing hour.**
### Now ### Now
```python ```python
@ -915,8 +915,7 @@ from functools import lru_cache
def fib(n): def fib(n):
return n if n < 2 else fib(n-2) + fib(n-1) return n if n < 2 else fib(n-2) + fib(n-1)
``` ```
* **In CPython recursion depth is limited to 1000 by default. To increase it use `'sys.setrecursionlimit(<depth>)'`.**
* **CPython interpreter limits recursion depth to 1000 by default. To increase it use `'sys.setrecursionlimit(<depth>)'`.**
### Parametrized Decorator ### Parametrized Decorator
**A decorator that accepts arguments and returns a normal decorator that accepts a function.** **A decorator that accepts arguments and returns a normal decorator that accepts a function.**

4
index.html

@ -656,7 +656,7 @@ shuffle(&lt;list&gt;)
<ul> <ul>
<li><strong>Use <code class="python hljs"><span class="hljs-string">'&lt;D/DT&gt;.weekday()'</span></code> to get the day of the week (Mon == 0).</strong></li> <li><strong>Use <code class="python hljs"><span class="hljs-string">'&lt;D/DT&gt;.weekday()'</span></code> to get the day of the week (Mon == 0).</strong></li>
<li><strong><code class="python hljs"><span class="hljs-string">'fold=1'</span></code> means second pass in case of time jumping back for one hour.</strong></li> <li><strong><code class="python hljs"><span class="hljs-string">'fold=1'</span></code> means second pass in case of time jumping back for one hour.</strong></li>
<li><strong><code class="apache hljs"><code class="python language-python hljs"><span class="hljs-string">'&lt;DT&gt; = resolve_imaginary(&lt;DT&gt;)'</span></code></code> fixes DTs that fall into missing hour.</strong></li>
<li><strong><code class="python hljs"><span class="hljs-string">'&lt;DTa&gt; = resolve_imaginary(&lt;DTa&gt;)'</span></code> fixes DTs that fall into missing hour.</strong></li>
</ul> </ul>
<div><h3 id="now">Now</h3><pre><code class="python language-python hljs">&lt;D/DTn&gt; = D/DT.today() <span class="hljs-comment"># Current local date or naive datetime.</span> <div><h3 id="now">Now</h3><pre><code class="python language-python hljs">&lt;D/DTn&gt; = D/DT.today() <span class="hljs-comment"># Current local date or naive datetime.</span>
&lt;DTn&gt; = DT.utcnow() <span class="hljs-comment"># Naive datetime from current UTC time.</span> &lt;DTn&gt; = DT.utcnow() <span class="hljs-comment"># Naive datetime from current UTC time.</span>
@ -892,7 +892,7 @@ creature = Creature(Point(<span class="hljs-number">0</span>, <span class="hljs
<ul> <ul>
<li><strong>In CPython recursion depth is limited to 1000 by default. To increase it use <code class="python hljs"><span class="hljs-string">'sys.setrecursionlimit(&lt;depth&gt;)'</span></code>.</strong></li>
<li><strong>CPython interpreter limits recursion depth to 1000 by default. To increase it use <code class="python hljs"><span class="hljs-string">'sys.setrecursionlimit(&lt;depth&gt;)'</span></code>.</strong></li>
</ul> </ul>
<div><h3 id="parametrizeddecorator">Parametrized Decorator</h3><p><strong>A decorator that accepts arguments and returns a normal decorator that accepts a function.</strong></p><pre><code class="python language-python hljs"><span class="hljs-keyword">from</span> functools <span class="hljs-keyword">import</span> wraps <div><h3 id="parametrizeddecorator">Parametrized Decorator</h3><p><strong>A decorator that accepts arguments and returns a normal decorator that accepts a function.</strong></p><pre><code class="python language-python hljs"><span class="hljs-keyword">from</span> functools <span class="hljs-keyword">import</span> wraps

Loading…
Cancel
Save