From 7fbf236b4cc07c52f9fa98a19c2d318ee3d813e3 Mon Sep 17 00:00:00 2001 From: Mark Pilgrim Date: Sun, 19 Jul 2009 14:06:51 -0400 Subject: [PATCH] new forward links --- whats-new.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/whats-new.html b/whats-new.html index 49ec9ab..1c5663a 100644 --- a/whats-new.html +++ b/whats-new.html @@ -27,9 +27,9 @@ h3:before{content:''}

Case Study: Porting chardet to Python 3 documents my (ultimately successful) effort to port a non-trivial library from Python 2 to Python 3. It may help you; it may not. There’s a fairly steep learning curve, since you need to kind of understand the library first, so you can understand why it broke and how I fixed it. A lot of the breakage centers around strings. Speaking of which… -

Strings. Whew. Where to start. Python 2 had “strings” and “Unicode strings.” Python 3 has “bytes” and “strings.” That is, all strings are now Unicode strings, and if you want to deal with a bag of bytes, you use the new bytes type. Oh, and Python 3 will never implicitly convert between strings and bytes, so if you’re not sure which one you have, your code will almost certainly break. Read the Strings chapter for more details. +

Strings. Whew. Where to start. Python 2 had “strings” and “Unicode strings.” Python 3 has “bytes” and “strings.” That is, all strings are now Unicode strings, and if you want to deal with a bag of bytes, you use the new bytes type. Python 3 will never implicitly convert between strings and bytes, so if you’re not sure which one you have at any given moment, your code will almost certainly break. Read the Strings chapter for more details. Bytes vs. strings comes up again in the Files chapter, and again in the HTTP web services chapter, and again in the aforementioned case study. It will come up again and again in your code, too. Trust me. -

Even if you don’t care about Unicode, you’ll want to read about string formatting in Python 3, which is completely different from Python 2. +

Even if you don’t care about Unicode (oh but you will), you’ll want to read about string formatting in Python 3, which is completely different from Python 2.

Iterators are everywhere in Python 3, and I understand them a lot better than I did five years ago when I wrote “Dive Into Python”. You need to understand them too, because lots of functions that used to return lists in Python 2 will now return iterators in Python 3. At a minimum, you should read the second half of the Iterators chapter and the second half of the Advanced Iterators chapter.