mirror of
https://github.com/kennethreitz/dive-into-python3.git
synced 2026-06-05 15:00:18 +00:00
missing asterisms. seriously.
This commit is contained in:
@@ -304,6 +304,8 @@ except ImportError:
|
||||
|
||||
<p>By the end of this <code>try..except</code> block, you have imported <em>some</em> module and named it <var>etree</var>. Since both modules implement a common <abbr>API</abbr>, the rest of your code doesn’t need to keep checking which module got imported. And since the module that <em>did</em> get imported is always called <var>etree</var>, the rest of your code doesn’t need to be littered with <code>if</code> statements to call differently-named modules.
|
||||
|
||||
<p class=a>⁂
|
||||
|
||||
<h2 id=nameerror>Unbound Variables</h2>
|
||||
|
||||
<p>Take another look at this line of code from the <code>approximate_size()</code> function:
|
||||
@@ -322,6 +324,8 @@ NameError: name 'x' is not defined</samp>
|
||||
|
||||
<p>You will thank Python for this one day.
|
||||
|
||||
<p class=a>⁂
|
||||
|
||||
<h2 id=case>Everything is Case-Sensitive</h2>
|
||||
|
||||
<p>All names in Python are case-sensitive: variable names, function names, class names, module names, exception names. If you can get it, set it, call it, construct it, import it, or raise it, it’s case-sensitive.
|
||||
|
||||
Reference in New Issue
Block a user