typos [thanks G.P.]

This commit is contained in:
Mark Pilgrim
2009-06-01 12:30:52 -07:00
parent 7e2b1808a8
commit a09b073960
3 changed files with 9 additions and 6 deletions
@@ -625,6 +625,7 @@ ImportError: No module named constants</samp></pre>
<pre><code>from . import constants
import sys</code></pre>
<p>There are variations of this problem scattered throughout the <code>chardet</code> library. In some places it&#8217;s &#8220;<code>import constants, sys</code>&#8221;; in other places, it&#8217;s &#8220;<code>import constants, re</code>&#8221;. The fix is the same: manually split the import statement into two lines, one for the relative import, the other for the absolute import.
<p>FIXME-xref to as-yet-unwritten PEP 8 style section (which says you should put all imports on their own line)
<p>Onward!
<h3 id=namefileisnotdefined>Name <var>'file'</var> is not defined</h3>
<aside>open() is the new file(). PapayaWhip is the new black.</aside>
+6 -4
View File
@@ -44,7 +44,7 @@ td a:link, td a:visited{border:0}
<th>And Python Calls&hellip;
<tr><th>&#x2460;
<td>to initialize an instance
<td><code>x = MyCustomClass()</code>
<td><code>x = MyClass()</code>
<td><code>x.__init__()</code>
<tr><th>&#x2461;
<td>the &#8220;official&#8221; representation as a string
@@ -108,11 +108,11 @@ td a:link, td a:visited{border:0}
<th>You Want&hellip;
<th>So You Write&hellip;
<th>And Python Calls&hellip;
<tr><th>&#x2461;
<tr><th>&#x2460;
<td>to get a computed attribute (unconditionally)
<td><code>x.my_property</code>
<td><a href=http://www.python.org/doc/3.0/reference/datamodel.html#object.__getattribute__><code>x.__getattribute__(<var>"my_property"</var>)</code></a>
<tr><th>&#x2460;
<tr><th>&#x2461;
<td>to get a computed attribute (fallback)
<td><code>x.my_property</code>
<td><a href=http://www.python.org/doc/3.0/reference/datamodel.html#object.__getattr__><code>x.__getattr__(<var>"my_property"</var>)</code></a>
@@ -214,7 +214,7 @@ AttributeError</samp></pre>
<th>You Want&hellip;
<th>So You Write&hellip;
<th>And Python Calls&hellip;
<tr><th>&#x2460;
<tr><th>
<td>to &#8220;call&#8221; an instance like a function
<td><code>my_instance()</code>
<td><a href=http://www.python.org/doc/3.0/reference/datamodel.html#object.__call__><code>my_instance.__call__()</code></a>
@@ -738,6 +738,8 @@ class FieldStorage:
<p>This is how the [FIXME-xref] <code>with <var>file</var></code> idiom works.
<p>FIXME-xref to as-yet-unwritten section on function annotations
<pre><code># excerpt from io.py:
def _checkClosed(self, msg=None):
"""Internal: raise an ValueError if file is closed
+2 -2
View File
@@ -34,8 +34,6 @@ ul li ol{margin:0;padding:0 0 0 2.5em}
<li><a href=your-first-python-program.html#readability>Writing readable code</a>
<ol>
<li><a href=your-first-python-program.html#docstrings>Docstrings</a>
<li><a href=your-first-python-program.html#functionannotations>Function annotations</a>
<li><a href=your-first-python-program.html#styleconventions>Style conventions</a>
</ol>
<li><a href=your-first-python-program.html#everythingisanobject>Everything is an object</a>
<ol>
@@ -393,6 +391,8 @@ ul li ol{margin:0;padding:0 0 0 2.5em}
<li>Set comprehensions
<li>Dictionary comprehensions
<li>Views (several dictionary methods return them, they're dynamic, update when the dictionary changes, etc.)
<li>Function annotations
<li>PEP 8 style conventions
<li>Importing modules
<ol>
<li>...mention why from module import * is only allowed at module level