new forward links

This commit is contained in:
Mark Pilgrim
2009-07-19 14:06:51 -04:00
parent 97d84abb5e
commit 7fbf236b4c
+2 -2
View File
@@ -27,9 +27,9 @@ h3:before{content:''}
<p><a href=case-study-porting-chardet-to-python-3.html>Case Study: Porting <code>chardet</code> to Python 3</a> 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&#8217;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&hellip;
<p>Strings. Whew. Where to start. Python 2 had &#8220;strings&#8221; and &#8220;Unicode strings.&#8221; Python 3 has &#8220;bytes&#8221; and &#8220;strings.&#8221; That is, all strings are now Unicode strings, and if you want to deal with a bag of bytes, you use the new <code>bytes</code> type. Oh, and Python 3 will never implicitly convert between strings and bytes, so if you&#8217;re not sure which one you have, your code will almost certainly break. Read <a href=strings.html>the Strings chapter</a> for more details.
<p>Strings. Whew. Where to start. Python 2 had &#8220;strings&#8221; and &#8220;Unicode strings.&#8221; Python 3 has &#8220;bytes&#8221; and &#8220;strings.&#8221; That is, all strings are now Unicode strings, and if you want to deal with a bag of bytes, you use the new <code>bytes</code> type. Python 3 will <em>never</em> implicitly convert between strings and bytes, so if you&#8217;re not sure which one you have at any given moment, your code will almost certainly break. Read <a href=strings.html>the Strings chapter</a> for more details. Bytes vs. strings comes up again in <a href=files.html>the Files chapter</a>, and again in <a href=http-web-services.html>the <abbr>HTTP</abbr> web services chapter</a>, and again in <a href=case-study-porting-chardet-to-python-3.html>the aforementioned case study</a>. It will come up again and again in your code, too. Trust me.
<p>Even if you don&#8217;t care about Unicode, you&#8217;ll want to read about <a href=strings.html#formatting-strings>string formatting in Python 3</a>, which is completely different from Python 2.
<p>Even if you don&#8217;t care about Unicode (oh but you will), you&#8217;ll want to read about <a href=strings.html#formatting-strings>string formatting in Python 3</a>, which is completely different from Python 2.
<p>Iterators are everywhere in Python 3, and I understand them a lot better than I did five years ago when I wrote &#8220;Dive Into Python&#8221;. 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 <a href=iterators.html#a-fibonacci-iterator>the second half of the Iterators chapter</a> and <a href=advanced-iterators.html#generator-expressions>the second half of the Advanced Iterators chapter</a>.