Browse Source

Exceptions, Cython

pull/135/head
Jure Šorn 2 years ago
parent
commit
a9b70faffa
2 changed files with 10 additions and 10 deletions
  1. 10
      README.md
  2. 10
      index.html

10
README.md

@ -1398,10 +1398,10 @@ finally:
### Catching Exceptions
```python
except <exception>: ...
except <exception> as <name>: ...
except (<exception>, [...]): ...
except (<exception>, [...]) as <name>: ...
except <exception>:
except <exception> as <name>:
except (<exception>, [...]):
except (<exception>, [...]) as <name>:
```
* **Also catches subclasses of the exception.**
* **Use `'traceback.print_exc()'` to print the error message to stderr.**
@ -3498,7 +3498,7 @@ import <cython_script>
```python
cdef <ctype> <var_name> = <el>
cdef <ctype>[n_elements] <var_name> = [<el_1>, <el_2>, ...]
cdef <ctype/void> <func_name>(<ctype> <arg_name_1>, ...): …
cdef <ctype/void> <func_name>(<ctype> <arg_name>): ...
```
```python

10
index.html

@ -1200,10 +1200,10 @@ LogicOp = Enum(<span class="hljs-string">'LogicOp'</span>, {<span class="hljs-st
<li><strong>Code inside the <code class="python hljs"><span class="hljs-string">'else'</span></code> block will only be executed if <code class="python hljs"><span class="hljs-string">'try'</span></code> block had no exceptions.</strong></li>
<li><strong>Code inside the <code class="python hljs"><span class="hljs-string">'finally'</span></code> block will always be executed (unless a signal is received).</strong></li>
</ul>
<div><h3 id="catchingexceptions">Catching Exceptions</h3><pre><code class="python language-python hljs"><span class="hljs-keyword">except</span> &lt;exception&gt;: ...
<span class="hljs-keyword">except</span> &lt;exception&gt; <span class="hljs-keyword">as</span> &lt;name&gt;: ...
<span class="hljs-keyword">except</span> (&lt;exception&gt;, [...]): ...
<span class="hljs-keyword">except</span> (&lt;exception&gt;, [...]) <span class="hljs-keyword">as</span> &lt;name&gt;: ...
<div><h3 id="catchingexceptions">Catching Exceptions</h3><pre><code class="python language-python hljs"><span class="hljs-keyword">except</span> &lt;exception&gt;:
<span class="hljs-keyword">except</span> &lt;exception&gt; <span class="hljs-keyword">as</span> &lt;name&gt;:
<span class="hljs-keyword">except</span> (&lt;exception&gt;, [...]):
<span class="hljs-keyword">except</span> (&lt;exception&gt;, [...]) <span class="hljs-keyword">as</span> &lt;name&gt;:
</code></pre></div>
<ul>
@ -2844,7 +2844,7 @@ print(<span class="hljs-string">f'Hello <span class="hljs-subst">{values[<span c
<li><strong>Script needs to be saved with a <code class="python hljs"><span class="hljs-string">'pyx'</span></code> extension.</strong></li>
</ul><pre><code class="python language-python hljs">cdef &lt;ctype&gt; &lt;var_name&gt; = &lt;el&gt;
cdef &lt;ctype&gt;[n_elements] &lt;var_name&gt; = [&lt;el_1&gt;, &lt;el_2&gt;, ...]
cdef &lt;ctype/void&gt; &lt;func_name&gt;(&lt;ctype&gt; &lt;arg_name_1&gt;, ...): …
cdef &lt;ctype/void&gt; &lt;func_name&gt;(&lt;ctype&gt; &lt;arg_name&gt;): ...
</code></pre></div>

Loading…
Cancel
Save