diff --git a/about.html b/about.html index 9fab929..4f62e4d 100644 --- a/about.html +++ b/about.html @@ -2,11 +2,11 @@ About the book - Dive Into Python 3 - + - +
 

You are here: Home Dive Into Python 3 diff --git a/advanced-classes.html b/advanced-classes.html index a44fad4..215c345 100644 --- a/advanced-classes.html +++ b/advanced-classes.html @@ -3,11 +3,11 @@ Advanced Classes - Dive into Python 3 - + - +

  

You are here: Home Dive Into Python 3 diff --git a/advanced-iterators.html b/advanced-iterators.html index 711a49c..216c4f0 100644 --- a/advanced-iterators.html +++ b/advanced-iterators.html @@ -2,11 +2,12 @@ Advanced Iterators - Dive into Python 3 - + + - +

  

You are here: Home Dive Into Python 3 diff --git a/case-study-porting-chardet-to-python-3.html b/case-study-porting-chardet-to-python-3.html index 242690b..8725e9d 100644 --- a/case-study-porting-chardet-to-python-3.html +++ b/case-study-porting-chardet-to-python-3.html @@ -3,14 +3,14 @@ Case study: porting chardet to Python 3 - Dive into Python 3 - + - +

  

You are here: Home Dive Into Python 3 diff --git a/generators.html b/generators.html index e8ad402..b1275d1 100644 --- a/generators.html +++ b/generators.html @@ -2,11 +2,12 @@ Generators - Dive into Python 3 - + + - +

  

You are here: Home Dive Into Python 3 diff --git a/index.html b/index.html index a0de802..b5eee76 100644 --- a/index.html +++ b/index.html @@ -3,14 +3,14 @@ Dive Into Python 3 - + - +

 
@@ -45,8 +45,8 @@ h1:before{content:""}
  • Creating graphics with the Python Imaging Library
  • Where to go from here
  • Case Study: Porting chardet to Python 3 -
  • Porting Code to Python 3 with 2to3 -
  • Special Method Names +
  • Porting Code to Python 3 with 2to3 +
  • Special Method Names

    There is a changelog, a feed, and discussion on Reddit. During development, you can download the book by cloning the Mercurial repository: diff --git a/iterators-and-generators.html b/iterators-and-generators.html index 93af6d2..8c1b710 100644 --- a/iterators-and-generators.html +++ b/iterators-and-generators.html @@ -3,12 +3,12 @@ Secret Leftover Page - Dive into Python 3 - + - +

      

    You are here: Home Dive Into Python 3 diff --git a/iterators.html b/iterators.html index dd52516..196e3c0 100644 --- a/iterators.html +++ b/iterators.html @@ -2,11 +2,12 @@ Iterators - Dive into Python 3 - + + - +

      

    You are here: Home Dive Into Python 3 diff --git a/native-datatypes.html b/native-datatypes.html index 87ba89f..acaac7a 100644 --- a/native-datatypes.html +++ b/native-datatypes.html @@ -2,11 +2,12 @@ Native datatypes - Dive into Python 3 - + + - +

      

    You are here: Home Dive Into Python 3 diff --git a/porting-code-to-python-3-with-2to3.html b/porting-code-to-python-3-with-2to3.html index ae0750c..a2cb1b7 100644 --- a/porting-code-to-python-3-with-2to3.html +++ b/porting-code-to-python-3-with-2to3.html @@ -2,7 +2,8 @@ Porting code to Python 3 with 2to3 - Dive into Python 3 - + + - +

      

    You are here: Home Dive Into Python 3 diff --git a/publish b/publish index 29e2904..7706020 100755 --- a/publish +++ b/publish @@ -34,7 +34,7 @@ sed -i -e "s|;}|}|g" build/m-$revision.css # put CSS inline css=`cat build/$revision.css` mobilecss=`cat build/m-$revision.css` -sed -i -e "s|||g" -e "s|||g" -e "s||g" -e "s|||g" -e "s| - +

      

    You are here: Home Dive Into Python 3 diff --git a/regular-expressions.html b/regular-expressions.html index f6ab98e..c7f9f1b 100644 --- a/regular-expressions.html +++ b/regular-expressions.html @@ -2,11 +2,12 @@ Regular expressions - Dive into Python 3 - + + - +

      

    You are here: Home Dive Into Python 3 diff --git a/special-method-names.html b/special-method-names.html index 870e989..5297c81 100644 --- a/special-method-names.html +++ b/special-method-names.html @@ -3,7 +3,7 @@ Special Method Names - Dive into Python 3 - + - +

      

    You are here: Home Dive Into Python 3 diff --git a/strings.html b/strings.html index 2ea3aa3..802148e 100644 --- a/strings.html +++ b/strings.html @@ -2,12 +2,12 @@ Strings - Dive into Python 3 - + + - +

      

    You are here: Home Dive Into Python 3 @@ -156,12 +156,12 @@ def approximate_size(size, a_kilobyte_is_1024_bytes=True): '1000KB = 1MB'

      -
    1. Rather than calling any function in the humansize module, you’re just grabbing one of the data structures it defines: the list of "SI" (powers-of-1000) suffixes. +
    2. Rather than calling any function in the humansize module, you’re just grabbing one of the data structures it defines: the list of “SI” (powers-of-1000) suffixes.
    3. This looks complicated, but it’s not. {0} would refer to the first argument passed to the format() method, si_suffixes. But si_suffixes is a list. So {0[0]} refers to the first item of the list which is the first argument passed to the format() method: 'KB'. Meanwhile, {0[1]} refers to the second item of the same list: 'MB'. Everything outside the curly braces — including 1000, the equals sign, and the spaces — is untouched. The final result is the string '1000KB = 1MB'.
    -

    What this example shows is that format specifers can access items and properties of data structures using (almost) Python syntax. This is called compound field names. The following compound field names "just work": +

    What this example shows is that format specifers can access items and properties of data structures using (almost) Python syntax. This is called compound field names. The following compound field names “just work”: