mirror of
https://github.com/kennethreitz/dive-into-python3.git
synced 2026-06-05 23:10:17 +00:00
skeleton of advanced iterators chapter
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
<title>Iterators & generators - Dive into Python 3</title>
|
||||
<link rel=stylesheet type=text/css href=dip3.css>
|
||||
<style>
|
||||
body{counter-reset:h1 11}
|
||||
body{counter-reset:h1 5}
|
||||
</style>
|
||||
</head>
|
||||
<form action=http://www.google.com/cse><div><input type=hidden name=cx value=014021643941856155761:l5eihuescdw><input type=hidden name=ie value=UTF-8> <input name=q size=31> <input type=submit name=sa value=Search></div></form>
|
||||
@@ -15,9 +15,8 @@ body{counter-reset:h1 11}
|
||||
</blockquote>
|
||||
<p id=toc>
|
||||
<h2 id=divingin>Diving In</h2>
|
||||
<p class=f>Let’s talk about plural nouns. Also, functions that return other functions, advanced regular expressions, iterators, and generators. But first, let’s talk about how to make plural nouns. (If you haven’t read <a href=regular-expressions.html>the chapter on regular expressions</a>, now would be a good time. This chapter assumes you understand the basics of regular expressions, and quickly descends into more advanced uses.)
|
||||
<p>English is a schizophrenic language that borrows from a lot of other languages, and the rules for making singular nouns into plural nouns are varied and complex. There are rules, and then there are exceptions to those rules, and then there are exceptions to the exceptions.
|
||||
<aside>English is a schizophrenic language.</aside>
|
||||
<p class=f>English is a schizophrenic language that borrows words from many other languages. The most basic linguistic operations, like taking a singular noun and turning it into a plural noun, are complicated by the language's mixed heritage. There are rules, and then there are exceptions to those rules, and then there are exceptions to the exceptions.
|
||||
<p>In this chapter, you’re going to learn about about plural nouns. Also, functions that return other functions, advanced regular expressions, iterators, and generators. But first, let’s talk about how to make plural nouns. (If you haven’t read <a href=regular-expressions.html>the chapter on regular expressions</a>, now would be a good time. This chapter assumes you understand the basics of regular expressions, and it quickly descends into more advanced uses.)
|
||||
<p>If you grew up in an English-speaking country or learned English in a formal school setting, you’re probably familiar with the basic rules:
|
||||
<ul>
|
||||
<li>If a word ends in S, X, or Z, add ES. <i>Bass</i> becomes <i>basses</i>, <i>fax</i> becomes <i>faxes</i>, and <i>waltz</i> becomes <i>waltzes</i>.
|
||||
@@ -250,6 +249,7 @@ $ $ s</code></pre>
|
||||
|
||||
<p>Now let’s see how you can use this rules file.
|
||||
|
||||
<p>[FIXME: now that this chapter comes before the I/O chapter, need to at least mention what open() does]
|
||||
<p class=d>[<a href=examples/plural4.py>download <code>plural4.py</code></a>]
|
||||
<pre><code>import re
|
||||
|
||||
|
||||
Reference in New Issue
Block a user