you wouldn't believe me if I told you

This commit is contained in:
Mark Pilgrim
2009-06-05 23:39:50 -04:00
parent cbdb346531
commit 654b102d74
64 changed files with 724 additions and 764 deletions
+5 -5
View File
@@ -26,7 +26,7 @@ body{counter-reset:h1 6}
<p class=d>[<a href=examples/fibonacci2.py>download <code>fibonacci2.py</code></a>]
<pre><code>class Fib:
"""iterator that yields numbers in the Fibonacci sequence"""
'''iterator that yields numbers in the Fibonacci sequence'''
def __init__(self, max):
self.max = max
@@ -67,7 +67,7 @@ class PapayaWhip: <span>&#x2460;</span>
<p>This <code>PapayaWhip</code> class doesn&#8217;t define any methods or attributes, but syntactically, there needs to be something in the definition, thus the <code>pass</code> statement. This is a Python reserved word that just means &#8220;move along, nothing to see here&#8221;. It&#8217;s a statement that does nothing, and it&#8217;s a good placeholder when you&#8217;re stubbing out functions or classes.
<blockquote class="note compare java">
<blockquote class='note compare java'>
<p><span>&#x261E;</span>The <code>pass</code> statement in Python is like a empty set of curly braces (<code>{}</code>) in Java or C.
</blockquote>
@@ -79,7 +79,7 @@ class PapayaWhip: <span>&#x2460;</span>
<pre><code>
class Fib:
<a> """iterator that yields numbers in the Fibonacci sequence""" <span>&#x2460;</span></a>
<a> '''iterator that yields numbers in the Fibonacci sequence''' <span>&#x2460;</span></a>
<a> def __init__(self, max): <span>&#x2461;</span></a></code></pre>
<ol>
@@ -112,7 +112,7 @@ class Fib:
<li>You can access the instance&#8217;s <code>docstring</code> just as with a function or a module. All instances of a class share the same <code>docstring</code>.
</ol>
<blockquote class="note compare java">
<blockquote class='note compare java'>
<p><span>&#x261E;</span>In Python, simply call a class as if it were a function to create a new instance of the class. There is no explicit <code>new</code> operator like <abbr>C++</abbr> or Java.
</blockquote>
@@ -374,7 +374,7 @@ rules = LazyRules()</code></pre>
<li><a href=http://www.python.org/dev/peps/pep-0255/>PEP 255: Simple Generators</a>
</ul>
<p class=nav><a rel=prev href=generators.html title="back to &#8220;Generators&#8221;"><span>&#x261C;</span></a> <a rel=next href=advanced-iterators.html title="onward to &#8220;Advanced Iterators&#8221;"><span>&#x261E;</span></a>
<p class=v><a href=generators.html rel=prev title='back to &#8220;Generators&#8221;'><span>&#x261C;</span></a> <a href=advanced-iterators.html rel=next title='onward to &#8220;Advanced Iterators&#8221;'><span>&#x261E;</span></a>
<p class=c>&copy; 2001&ndash;9 <a href=about.html>Mark Pilgrim</a>
<script src=j/jquery.js></script>