diff --git a/case-study-porting-chardet-to-python-3.html b/case-study-porting-chardet-to-python-3.html index f30a909..595e865 100644 --- a/case-study-porting-chardet-to-python-3.html +++ b/case-study-porting-chardet-to-python-3.html @@ -1115,7 +1115,7 @@ tests\Big5\0804.blogspot.com.xml File "C:\home\chardet\chardet\latin1prober.py", line 126, in get_confidence total = reduce(operator.add, self._mFreqCounter) NameError: global name 'reduce' is not defined -

According to the official What's New In Python 3.0 guide, the reduce() function has been moved out of the global namespace and into the functools module. Quoting the guide: "Use functools.reduce() if you really need it; however, 99 percent of the time an explicit for loop is more readable." You can read more about the decision from Guido van Rossum's weblog: The fate of reduce() in Python 3000. +

According to the official What's New In Python 3.0 guide, the reduce() function has been moved out of the global namespace and into the functools module. Quoting the guide: "Use functools.reduce() if you really need it; however, 99 percent of the time an explicit for loop is more readable." You can read more about the decision from Guido van Rossum's weblog: The fate of reduce() in Python 3000.

def get_confidence(self):
     if self.get_state() == constants.eNotMe:
         return 0.01
diff --git a/native-datatypes.html b/native-datatypes.html
index 26d4aaf..ff9f3f5 100644
--- a/native-datatypes.html
+++ b/native-datatypes.html
@@ -448,8 +448,8 @@ KeyError: 'db.diveintopython3.org'
yes, it's true

Further Reading

diff --git a/strings.html b/strings.html index 12c3ffd..77d2da1 100644 --- a/strings.html +++ b/strings.html @@ -219,7 +219,7 @@ def approximate_size(size, a_kilobyte_is_1024_bytes=True): >>> "{0:.1f} {1}".format(698.25, 'GB') '698.3 GB' -

For all the gory details on format specifiers, consult the Format Specification Mini-Language in the official Python documentation. +

For all the gory details on format specifiers, consult the Format Specification Mini-Language in the official Python documentation.

Other Common String Methods

@@ -359,8 +359,8 @@ is an object. You might have thought I meant that string variables are

On Unicode in Python:

On Unicode in general: @@ -382,9 +382,9 @@ is an object. You might have thought I meant that string variables are

On strings and string formatting: