diff --git a/about.html b/about.html index c5009c0..0a60fdc 100644 --- a/about.html +++ b/about.html @@ -11,7 +11,6 @@ h1:before{content:""} -
'bytes' object to str implicitly
'int' and 'bytes'
ord() expected string of length 1, but int found
- int() >= str()
+ int() >= str()
'reduce' is not defined
…and latin1prober.py…
-
# latin1prober.py
def feed(self, aBuf):
aBuf = self.filter_with_english_letters(aBuf)
for c in aBuf:
charClass = Latin1_CharToClass[ord(c)]
-c is iterating over aBuf, which means it is an integer, not a 1-character string. The solution is the same: change ord(c) to just plain c.
+
c is iterating over aBuf, which means it is an integer, not a 1-character string. The solution is the same: change ord(c) to just plain c.
# sbcharsetprober.py
@@ -1010,7 +1009,7 @@ tests\Big5\0804.blogspot.com.xml
File "C:\home\chardet\chardet\jpcntx.py", line 145, in feed
order, charLen = self.get_order(aBuf[i:i+2])
File "C:\home\chardet\chardet\jpcntx.py", line 176, in get_order
- if ((aStr[0] >= '\x81') and (aStr[0] <= '\x9F')) or \
+ if ((aStr[0] >= '\x81') and (aStr[0] <= '\x9F')) or \
TypeError: unorderable types: int() >= str()
Did you notice? This time around, the code passed the first test case (tests\ascii\howto.diveintomark.org.xml). You're making real progress here.
@@ -1036,7 +1035,7 @@ TypeError: unorderable types: int() >= str()
.
.
i = self._mNeedToSkipCharNum
- while i < aLen:
+ while i < aLen:
order, charLen = self.get_order(aBuf[i:i+2])
Oh look, it's our old friend, aBuf. As you might have guessed from every other issue we've encountered in this chapter, aBuf is a byte array. Here, the feed() method isn't just passing it on wholesale; it's slicing it. But as you saw earlier in this chapter, slicing a byte array returns a byte array, so the aStr parameter that gets passed to the get_order() method is still a byte array.
diff --git a/index.html b/index.html
index d3d678c..e3b3d78 100644
--- a/index.html
+++ b/index.html
@@ -14,7 +14,6 @@ li:last-child:before{content:"A. \00a0 \00a0"}
li.todo{background:white;color:gainsboro}
-
Dive Into Python 3 will cover Python 3 and its differences from Python 2. Compared to the original Dive Into Python, it will be about 50% revised and 50% new material. I will publish drafts online as I go. The final version will be published on paper by Apress. The book will remain online under the CC-BY-SA-3.0 license.
You can see the full table of contents (not finalized), or read what I’ve written so far:
diff --git a/native-datatypes.html b/native-datatypes.html index a17fb85..7790453 100644 --- a/native-datatypes.html +++ b/native-datatypes.html @@ -11,7 +11,6 @@ body{counter-reset:h1 2} -