From a09b073960ba05436b14c195b8bafc1f4708b0af Mon Sep 17 00:00:00 2001 From: Mark Pilgrim Date: Mon, 1 Jun 2009 12:30:52 -0700 Subject: [PATCH] typos [thanks G.P.] --- case-study-porting-chardet-to-python-3.html | 1 + special-method-names.html | 10 ++++++---- table-of-contents.html | 4 ++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/case-study-porting-chardet-to-python-3.html b/case-study-porting-chardet-to-python-3.html index 4e4b180..583c708 100644 --- a/case-study-porting-chardet-to-python-3.html +++ b/case-study-porting-chardet-to-python-3.html @@ -625,6 +625,7 @@ ImportError: No module named constants
from . import constants
 import sys

There are variations of this problem scattered throughout the chardet library. In some places it’s “import constants, sys”; in other places, it’s “import constants, re”. The fix is the same: manually split the import statement into two lines, one for the relative import, the other for the absolute import. +

FIXME-xref to as-yet-unwritten PEP 8 style section (which says you should put all imports on their own line)

Onward!

Name 'file' is not defined

diff --git a/special-method-names.html b/special-method-names.html index f1d2d83..dcef78a 100644 --- a/special-method-names.html +++ b/special-method-names.html @@ -44,7 +44,7 @@ td a:link, td a:visited{border:0} And Python Calls… ① to initialize an instance -x = MyCustomClass() +x = MyClass() x.__init__() ② the “official” representation as a string @@ -108,11 +108,11 @@ td a:link, td a:visited{border:0} You Want… So You Write… And Python Calls… -② +① to get a computed attribute (unconditionally) x.my_property x.__getattribute__("my_property") -① +② to get a computed attribute (fallback) x.my_property x.__getattr__("my_property") @@ -214,7 +214,7 @@ AttributeError You Want… So You Write… And Python Calls… -① + to “call” an instance like a function my_instance() my_instance.__call__() @@ -738,6 +738,8 @@ class FieldStorage:

This is how the [FIXME-xref] with file idiom works. +

FIXME-xref to as-yet-unwritten section on function annotations +

# excerpt from io.py:
 def _checkClosed(self, msg=None):
     """Internal: raise an ValueError if file is closed
diff --git a/table-of-contents.html b/table-of-contents.html
index a176ac0..920c18f 100644
--- a/table-of-contents.html
+++ b/table-of-contents.html
@@ -34,8 +34,6 @@ ul li ol{margin:0;padding:0 0 0 2.5em}
   
  • Writing readable code
    1. Docstrings -
    2. Function annotations -
    3. Style conventions
  • Everything is an object
      @@ -393,6 +391,8 @@ ul li ol{margin:0;padding:0 0 0 2.5em}
    1. Set comprehensions
    2. Dictionary comprehensions
    3. Views (several dictionary methods return them, they're dynamic, update when the dictionary changes, etc.) +
    4. Function annotations +
    5. PEP 8 style conventions
    6. Importing modules
      1. ...mention why from module import * is only allowed at module level