Browse Source

Exceptions

pull/42/head
Jure Šorn 5 years ago
parent
commit
3e121fb9a6
2 changed files with 6 additions and 6 deletions
  1. 6
      README.md
  2. 6
      index.html

6
README.md

@ -1353,8 +1353,8 @@ finally:
```python
except <exception>:
except <exception> as <name>:
except (<exception_1>, <exception_2>, ...):
except (<exception_1>, <exception_2>, ...) as <name>:
except (<exception>, ...):
except (<exception>, ...) as <name>:
```
* **Also catches subclasses of the exception.**
@ -1363,7 +1363,7 @@ except (<exception_1>, <exception_2>, ...) as <name>:
raise <exception>
raise <exception>()
raise <exception>(<el>)
raise <exception>(<el_1>, <el_2>, ...)
raise <exception>(<el>, ...)
```
#### Useful built-in exceptions:

6
index.html

@ -1261,8 +1261,8 @@ LogicOp = Enum(<span class="hljs-string">'LogicOp'</span>, {<span class="hljs-st
<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_1&gt;, &lt;exception_2&gt;, ...):
<span class="hljs-keyword">except</span> (&lt;exception_1&gt;, &lt;exception_2&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>
@ -1271,7 +1271,7 @@ LogicOp = Enum(<span class="hljs-string">'LogicOp'</span>, {<span class="hljs-st
<div><h3 id="raisingexceptions">Raising Exceptions</h3><pre><code class="python language-python hljs"><span class="hljs-keyword">raise</span> &lt;exception&gt;
<span class="hljs-keyword">raise</span> &lt;exception&gt;()
<span class="hljs-keyword">raise</span> &lt;exception&gt;(&lt;el&gt;)
<span class="hljs-keyword">raise</span> &lt;exception&gt;(&lt;el_1&gt;, &lt;el_2&gt;, ...)
<span class="hljs-keyword">raise</span> &lt;exception&gt;(&lt;el&gt;, ...)
</code></pre></div>
<div><h4 id="usefulbuiltinexceptions">Useful built-in exceptions:</h4><pre><code class="python language-python hljs"><span class="hljs-keyword">raise</span> ValueError(<span class="hljs-string">'Argument is of right type but inappropriate value!'</span>)

Loading…
Cancel
Save