stub for special-method-names chapter

This commit is contained in:
Mark Pilgrim
2009-04-21 00:03:51 -04:00
parent d77d31e68d
commit 5d31cc05a6
15 changed files with 397 additions and 5 deletions
+1
View File
@@ -10,6 +10,7 @@ body{counter-reset:h1 7}
</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>&nbsp;<input name=q size=25>&nbsp;<input type=submit name=sa value=Search></div></form>
<p>You are here: <a href=index.html>Home</a> <span>&#8227;</span> <a href=table-of-contents.html#advanced-iterators>Dive Into Python 3</a> <span>&#8227;</span>
<p id=level title=advanced>Difficulty level: <span>&#x2666;</span><span>&#x2666;</span><span>&#x2666;</span><span>&#x2666;</span><span>&#x2662;</span>
<h1>Advanced Iterators</h1>
<blockquote class=q>
<p><span>&#x275D;</span> Great fleas have little fleas upon their backs to bite &#8217;em,<br>And little fleas have lesser fleas, and so ad infinitum. <span>&#x275E;</span><br>&mdash; Augustus De Morgan
+1 -1
View File
@@ -14,6 +14,7 @@ del{background:#f87}
</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>&nbsp;<input name=q size=25>&nbsp;<input type=submit name=sa value=Search></div></form>
<p>You are here: <a href=index.html>Home</a> <span>&#8227;</span> <a href=table-of-contents.html#case-study-porting-chardet-to-python-3>Dive Into Python 3</a> <span>&#8227;</span>
<p id=level title=pro>Difficulty level: <span>&#x2666;</span><span>&#x2666;</span><span>&#x2666;</span><span>&#x2666;</span><span>&#x2666;</span>
<h1>Case Study: Porting <code>chardet</code> to Python 3</h1>
<blockquote class=q>
<p><span>&#x275D;</span> Words, words. They&#8217;re all we have to go on. <span>&#x275E;</span><br>&mdash; <a href=http://www.imdb.com/title/tt0100519/quotes>Rosencrantz and Guildenstern are Dead</a>
@@ -1179,7 +1180,6 @@ tests\EUC-JP\arclamp.jp.xml EUC-JP with confide
</ol>
<p class=nav><a rel=prev class=todo><span>&#x261C;</a> <a rel=next href=porting-code-to-python-3-with-2to3.html title="onward to &#8220;Porting Code to Python 3 with 2to3&#8221;"><span>&#x261E;</span></a>
<p class=c>&copy; 2001&ndash;9 <a href=about.html>Mark Pilgrim</a>
<script src=jquery.js></script>
<script src=dip3.js></script>
+2 -2
View File
@@ -69,7 +69,7 @@ p,ul,ol{margin:1.75em 0;font-size:medium}
html{background:#fff;color:#222}
body{margin:1.75em 28px}
.c{clear:both;text-align:center;margin:2.154em 0}
form div{float:right}
form div,#level{float:right}
.todo{color:#ddd}
/* links */
@@ -117,4 +117,4 @@ aside{display:block;float:right;font-style:oblique;font-size:xx-large;width:25%;
.nav a{text-decoration:none;border:0;display:block}
.nav a:first-child{float:left}
.nav a:last-child{float:right}
.nav span{font-size:1000%;line-height:1;margin:0}
.nav span{font-size:1000%;line-height:1;margin:0}
+83
View File
@@ -0,0 +1,83 @@
#
# OrderedDict will be part of the collections module in Python 3.1.
# This is a standalone version for demonstration purposes only.
# If you're using Python 3.0, you should upgrade to Python 3.1, then
# >>> from collections import OrderedDict
# instead of using this version.
#
# Provenance:
# - PEP 372: OrderedDict http://www.python.org/dev/peps/pep-0372/
# - Python bug 5397: implement PEP 372 http://bugs.python.org/issue5397
# - Bug 5397 attachment: http://bugs.python.org/file13231/od7.diff
#
from collections import MutableMapping
from itertools import zip_longest as _zip_longest
class OrderedDict(dict, MutableMapping):
def __init__(self, *args, **kwds):
if len(args) > 1:
raise TypeError('expected at most 1 arguments')
if not hasattr(self, '_keys'):
self._keys = []
self.update(*args, **kwds)
def clear(self):
del self._keys[:]
dict.clear(self)
def __setitem__(self, key, value):
if key not in self:
self._keys.append(key)
dict.__setitem__(self, key, value)
def __delitem__(self, key):
dict.__delitem__(self, key)
self._keys.remove(key)
def __iter__(self):
return iter(self._keys)
def __reversed__(self):
return reversed(self._keys)
def popitem(self):
if not self:
raise KeyError('dictionary is empty')
key = self._keys.pop()
value = dict.pop(self, key)
return key, value
def __reduce__(self):
items = [[k, self[k]] for k in self]
inst_dict = vars(self).copy()
inst_dict.pop('_keys', None)
return (self.__class__, (items,), inst_dict)
setdefault = MutableMapping.setdefault
update = MutableMapping.update
pop = MutableMapping.pop
keys = MutableMapping.keys
values = MutableMapping.values
items = MutableMapping.items
def __repr__(self):
if not self:
return '%s()' % (self.__class__.__name__,)
return '%s(%r)' % (self.__class__.__name__, list(self.items()))
def copy(self):
return self.__class__(self)
@classmethod
def fromkeys(cls, iterable, value=None):
d = cls()
for key in iterable:
d[key] = value
return d
def __eq__(self, other):
if isinstance(other, OrderedDict):
return all(p==q for p, q in _zip_longest(self.items(), other.items()))
return dict.__eq__(self, other)
+1
View File
@@ -10,6 +10,7 @@ body{counter-reset:h1 5}
</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>&nbsp;<input name=q size=25>&nbsp;<input type=submit name=sa value=Search></div></form>
<p>You are here: <a href=index.html>Home</a> <span>&#8227;</span> <a href=table-of-contents.html#generators>Dive Into Python 3</a> <span>&#8227;</span>
<p id=level title=intermediate>Difficulty level: <span>&#x2666;</span><span>&#x2666;</span><span>&#x2666;</span><span>&#x2662;</span><span>&#x2662;</span>
<h1>Generators</h1>
<blockquote class=q>
<p><span>&#x275D;</span> My spelling is Wobbly. It's good spelling but it Wobbles, and the letters get in the wrong places. <span>&#x275E;</span><br>&mdash; Winnie-the-Pooh
+65
View File
@@ -0,0 +1,65 @@
<!DOCTYPE html>
<head>
<meta name=robots content=noindex>
<meta charset=utf-8>
<title>Secret Leftover Page - Dive into Python 3</title>
<link rel=stylesheet type=text/css href=dip3.css>
<style>
body{counter-reset:h1 -1}
h1:before{counter-increment:h1;content:""}
</style>
<link rel=stylesheet type=text/css media='only screen and (max-device-width: 480px)' href=mobile.css>
</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>&nbsp;<input name=q size=25>&nbsp;<input type=submit name=sa value=Search></div></form>
<p>You are here: <a href=index.html>Home</a> <span>&#8227;</span> <a href=table-of-contents.html>Dive Into Python 3</a> <span>&#8227;</span>
<h1>Secret Leftover Page</h1>
<blockquote class=q>
<p><span>&#x275D;</span> You step in the stream / but the water has moved on. / This page is not here. <span>&#x275E;</span><br>&mdash; 404 Not Found haiku
</blockquote>
<p id=toc>&nbsp;
<h2 id=divingin>Huh?</h2>
<p class=f>This book used to have a chapter called &#8220;Iterators <i class=baa>&amp;</i> Generators,&#8221; but I split the chapter in half so I could introduce Python classes before talking about iterators. The content that used to be at this address is now in one of those two chapters:
<ul>
<li><a href=generators.html>Generators</a>
<li><a href=iterators.html>Iterators</a>
</ul>
<!--
<p>But since you&#8217;re here, I&#8217;d like to talk about some of the small stuff I sweated while writing this book.
<h2 id=typography>Typography</h2>
<p>vertical rhythm, best available ampersand, curly quotes/apostrophes, other stuff from webtypography.net
<h2 id=graphics>Graphics</h2>
<p>Unicode, callouts, font-family issues on Windows
<h2 id=performance>Performance</h2>
<p>"Dive Into History 2009 edition", minimizing CSS + JS + HTML, inline CSS, async jQuery
<h2 id=fun>Fun stuff</h2>
<p>Quotes, constrained writing, PapayaWhip
<h2 id=furtherreading>Further Reading</h2>
<ul>
<li><a href="http://webtypography.net/toc/">The Elements of Typographic Style Applied to the Web</a>
<li><a href="http://www.alistapart.com/articles/settingtypeontheweb">Setting Type on the Web to a Baseline Grid</a>
<li><a href="http://24ways.org/2006/compose-to-a-vertical-rhythm">Compose to a Vertical Rhythm</a>
<li><a href="http://simplebits.com/notebook/2008/08/14/ampersands.html">Use the Best Available Ampersand</a>
<li><a href="http://alanwood.net/unicode/">Unicode Support in HTML, Fonts, and Web Browsers</a>
<li><a href="http://developer.yahoo.com/yslow/">YSlow</a> for <a href="http://getfirebug.com/">Firebug</a>
<li><a href="http://developer.yahoo.com/performance/rules.html">Best Practices for Speeding Up Your Web Site</a>
<li><a href="http://stevesouders.com/hpws/rules.php">14 Rules for Faster-Loading Web Sites</a>
<li><a href="http://developer.yahoo.com/yui/compressor/">YUI Compressor</a>
<li><a href="http://code.google.com/apis/ajaxlibs/">Google AJAX Libraries API</a>
</ul>
-->
<p class=c>&copy; 2001&ndash;9 <a href=about.html>Mark Pilgrim</a>
<script src=jquery.js></script>
<script src=dip3.js></script>
+6 -2
View File
@@ -10,13 +10,16 @@ body{counter-reset:h1 6}
</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>&nbsp;<input name=q size=25>&nbsp;<input type=submit name=sa value=Search></div></form>
<p>You are here: <a href=index.html>Home</a> <span>&#8227;</span> <a href=table-of-contents.html#iterators>Dive Into Python 3</a> <span>&#8227;</span>
<p id=level title=intermediate>Difficulty level: <span>&#x2666;</span><span>&#x2666;</span><span>&#x2666;</span><span>&#x2662;</span><span>&#x2662;</span>
<h1>Iterators</h1>
<blockquote class=q>
<p><span>&#x275D;</span> East is East, and West is West, and never the twain shall meet. <span>&#x275E;</span><br>&mdash; <a href=http://en.wikiquote.org/wiki/Rudyard_Kipling>Rudyard Kipling</a>
</blockquote>
<p id=toc>&nbsp;
<h2 id=divingin>Diving In</h2>
<p class=f>Generators are really just a special case of <i>iterators</i>. A function that <code>yield</code>s values is a nice, compact way of building an iterator without building an iterator. Remember <a href=generators.html#a-fibonacci-generator>the Fibonacci generator</a>? Here it is as a built-from-scratch iterator:
<p class=f>Generators are really just a special case of <i>iterators</i>. A function that <code>yield</code>s values is a nice, compact way of building an iterator without building an iterator. Let me show you what I mean by that.
<p>Remember <a href=generators.html#a-fibonacci-generator>the Fibonacci generator</a>? Here it is as a built-from-scratch iterator:
<p class=d>[<a href=examples/fibonacci2.py>download <code>fibonacci2.py</code></a>]
<pre><code>class Fib:
@@ -48,10 +51,11 @@ body{counter-reset:h1 6}
<pre><code>
class PapayaWhip: <span>&#x2460;</span>
pass <span>&#x2461;</span></pre>
pass <span>&#x2461;</span></code></pre>
<ol>
<li>The name of this class is <code>PapayaWhip</code>, and it doesn't inherit from any other class. Class names are usually capitalized, <code>EachWordLikeThis</code>, but this is only a convention, not a requirement.
<li>You probably guessed this, but everything in a class is indented, just like the code within a function, <code>if</code> statement, <code>for</code> loop, or any other block of code. The first line not indented is outside the class.
</ol>
<p>This <code>PapayaWhip</code> class doesn'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's a statement that does nothing, and it's a good placeholder when you're stubbing out functions or classes.
+1
View File
@@ -10,6 +10,7 @@ body{counter-reset:h1 2}
</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>&nbsp;<input name=q size=25>&nbsp;<input type=submit name=root value=Search></div></form>
<p>You are here: <a href=index.html>Home</a> <span>&#8227;</span> <a href=table-of-contents.html#native-datatypes>Dive Into Python 3</a> <span>&#8227;</span>
<p id=level title=beginner>Difficulty level: <span>&#x2666;</span><span>&#x2666;</span><span>&#x2662;</span><span>&#x2662;</span><span>&#x2662;</span>
<h1>Native Datatypes</h1>
<blockquote class=q>
<p><span>&#x275D;</span> Wonder is the foundation of all philosophy, inquiry its progress, ignorance its end. <span>&#x275E;</span><br>&mdash; Michel de Montaigne
+1
View File
@@ -20,6 +20,7 @@ td pre{padding:0;border:0}
</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>&nbsp;<input name=q size=25>&nbsp;<input type=submit name=sa value=Search></div></form>
<p>You are here: <a href=index.html>Home</a> <span>&#8227;</span> <a href=table-of-contents.html#porting-code-to-python-3-with-2to3>Dive Into Python 3</a> <span>&#8227;</span>
<p id=level title=pro>Difficulty level: <span>&#x2666;</span><span>&#x2666;</span><span>&#x2666;</span><span>&#x2666;</span><span>&#x2666;</span>
<h1>Porting Code to Python 3 with <code>2to3</code></h1>
<blockquote class=q>
<p><span>&#x275D;</span> Life is pleasant. Death is peaceful. It&#8217;s the transition that&#8217;s troublesome. <span>&#x275E;</span><br>&mdash; Isaac Asimov (attributed)
+1
View File
@@ -10,6 +10,7 @@ body{counter-reset:h1 10}
</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>&nbsp;<input name=q size=25>&nbsp;<input type=submit name=root value=Search></div></form>
<p>You are here: <a href=index.html>Home</a> <span>&#8227;</span> <a href=table-of-contents.html#refactoring>Dive Into Python 3</a> <span>&#8227;</span>
<p id=level title=advanced>Difficulty level: <span>&#x2666;</span><span>&#x2666;</span><span>&#x2666;</span><span>&#x2666;</span><span>&#x2662;</span>
<h1>Refactoring</h1>
<blockquote class=q>
<p><span>&#x275D;</span> After one has played a vast quantity of notes and more notes, it is simplicity that emerges as the crowning reward of art. <span>&#x275E;</span><br>&mdash; <a href=http://en.wikiquote.org/wiki/Fr%C3%A9d%C3%A9ric_Chopin>Frédéric Chopin</a>
+1
View File
@@ -10,6 +10,7 @@ body{counter-reset:h1 4}
</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>&nbsp;<input name=q size=25>&nbsp;<input type=submit name=root value=Search></div></form>
<p>You are here: <a href=index.html>Home</a> <span>&#8227;</span> <a href=table-of-contents.html#regular-expressions>Dive Into Python 3</a> <span>&#8227;</span>
<p id=level title=intermediate>Difficulty level: <span>&#x2666;</span><span>&#x2666;</span><span>&#x2666;</span><span>&#x2662;</span><span>&#x2662;</span>
<h1>Regular Expressions</h1>
<blockquote class=q>
<p><span>&#x275D;</span> Some people, when confronted with a problem, think &#8220;I know, I&#8217;ll use regular expressions.&#8221; Now they have two problems. <span>&#x275E;</span><br>&mdash; <a href=http://www.jwz.org/hacks/marginal.html>Jamie Zawinski</a>
+231
View File
@@ -0,0 +1,231 @@
<!DOCTYPE html>
<head>
<meta charset=utf-8>
<title>Special Method Names - Dive into Python 3</title>
<!--[if IE]><script src=html5.js></script><![endif]-->
<link rel=stylesheet type=text/css href=dip3.css>
<style>
body{counter-reset:h1 11}
</style>
<link rel=stylesheet type=text/css media='only screen and (max-device-width: 480px)' href=mobile.css>
</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>&nbsp;<input name=q size=25>&nbsp;<input type=submit name=sa value=Search></div></form>
<p>You are here: <a href=index.html>Home</a> <span>&#8227;</span> <a href=table-of-contents.html#special-method-names>Dive Into Python 3</a> <span>&#8227;</span>
<p id=level title=advanced>Difficulty level: <span>&#x2666;</span><span>&#x2666;</span><span>&#x2666;</span><span>&#x2666;</span><span>&#x2662;</span>
<h1>Special Method Names</h1>
<blockquote class=q>
<p><span>&#x275D;</span> FIXME <span>&#x275E;</span><br>&mdash; FIXME
</blockquote>
<p id=toc>&nbsp;
<h2 id=divingin>Diving In</h2>
<p class=f>FIXME
<p class=d>[<a href=examples/ordereddict.py>download <code>ordereddict.py</code></a>]
<pre><code>import collections
import itertools
class OrderedDict(dict, collections.MutableMapping):
def __init__(self, *args, **kwds):
if len(args) > 1:
raise TypeError('expected at most 1 arguments')
if not hasattr(self, '_keys'):
self._keys = []
self.update(*args, **kwds)
def clear(self):
del self._keys[:]
dict.clear(self)
def __setitem__(self, key, value):
if key not in self:
self._keys.append(key)
dict.__setitem__(self, key, value)
def __delitem__(self, key):
dict.__delitem__(self, key)
self._keys.remove(key)
def __iter__(self):
return iter(self._keys)
def __reversed__(self):
return reversed(self._keys)
def popitem(self):
if not self:
raise KeyError('dictionary is empty')
key = self._keys.pop()
value = dict.pop(self, key)
return key, value
def __reduce__(self):
items = [[k, self[k]] for k in self]
inst_dict = vars(self).copy()
inst_dict.pop('_keys', None)
return (self.__class__, (items,), inst_dict)
setdefault = MutableMapping.setdefault
update = MutableMapping.update
pop = MutableMapping.pop
keys = MutableMapping.keys
values = MutableMapping.values
items = MutableMapping.items
def __repr__(self):
if not self:
return '%s()' % (self.__class__.__name__,)
return '%s(%r)' % (self.__class__.__name__, list(self.items()))
def copy(self):
return self.__class__(self)
@classmethod
def fromkeys(cls, iterable, value=None):
d = cls()
for key in iterable:
d[key] = value
return d
def __eq__(self, other):
if isinstance(other, OrderedDict):
return all(p==q for p, q in itertools.zip_longest(self.items(), other.items()))
return dict.__eq__(self, other)</code></pre>
<!--
Basics:
__init__
__repr__
__str__
__bytes__ (*)
__format__
Rich comparisons:
__lt__
__le__
__eq__
__ne__
__gt__
__ge__
__bool__
__cmp__ (*)
Custom attributes:
__getattr__
__getattribute__
__setattr__
__delattr__
__dir__
Acts like a function:
__call__
Acts like a list:
__len__
__reversed__
__contains__
__index__
__getslice__ (*)
Acts like a dictionary:
__getitem__
__setitem__
__delitem__
__missing__ (*)
Acts like an iterator:
__iter__ (*)
__next__ (*)
Acts like a number:
__add__
__sub__
__mul__
__truediv__
__floordiv__
__mod__
__divmod__
__pow__
__lshift__
__rshift__
__and__
__xor__
__or__
__radd__
__rsub__
__rmul__
__rtruediv__
__rfloordiv__
__rmod__
__rpow__
__rlshift__
__rrshift__
__rand__
__rxor__
__ror__
__iadd__
__isub__
__imul__
__itruediv__
__ifloordiv__
__imod__
__ipow__
__ilshift__
__irshift__
__iand__
__ixor__
__ior__
__neg__
__pos__
__abs__
__invert__
__complex__
__int__
__float__
__long__ (*)
__round__
__ceil__ (*)
__floor__ (*)
__trunc__ (*)
Support for pickling, see http://docs.python.org/3.0/library/pickle.html:
__copy__ (*)
__deepcopy__ (*)
__getnewargs__ (*)
__getinitargs__ (*)
__getstate__ (*)
__setstate__ (*)
__reduce__ (*)
__reduce_ex__ (*)
Really weird stuff:
__new__
__del__
__slots__
__hash__
__get__
__set__
__delete__
__enter__ see http://docs.python.org/3.0/library/stdtypes.html#typecontextmanager
__exit__
__subclasshook__ (*) see http://docs.python.org/3.0/library/abc.html
__instancecheck__ (*) see http://www.ibm.com/developerworks/linux/library/l-python3-2/
__subclasscheck__ (*)
-->
<p class=nav><a rel=prev class=todo><span>&#x261C;</a> <a rel=next class=todo><span>&#x261E;</span></a>
<p class=c>&copy; 2001&ndash;9 <a href=about.html>Mark Pilgrim</a>
<script src=jquery.js></script>
<script src=dip3.js></script>
+1
View File
@@ -11,6 +11,7 @@ body{counter-reset:h1 3}
</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>&nbsp;<input name=q size=25>&nbsp;<input type=submit name=sa value=Search></div></form>
<p>You are here: <a href=index.html>Home</a> <span>&#8227;</span> <a href=table-of-contents.html#strings>Dive Into Python 3</a> <span>&#8227;</span>
<p id=level title=intermediate>Difficulty level: <span>&#x2666;</span><span>&#x2666;</span><span>&#x2666;</span><span>&#x2662;</span><span>&#x2662;</span>
<h1>Strings</h1>
<blockquote class=q>
<p><span>&#x275D;</span> I&#8217;m telling you this &#8217;cause you&#8217;re one of my friends.<br>
+1
View File
@@ -10,6 +10,7 @@ body{counter-reset:h1 8}
</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>&nbsp;<input name=q size=25>&nbsp;<input type=submit name=root value=Search></div></form>
<p>You are here: <a href=index.html>Home</a> <span>&#8227;</span> <a href=table-of-contents.html#unit-testing>Dive Into Python 3</a> <span>&#8227;</span>
<p id=level title=intermediate>Difficulty level: <span>&#x2666;</span><span>&#x2666;</span><span>&#x2666;</span><span>&#x2662;</span><span>&#x2662;</span>
<h1>Unit Testing</h1>
<blockquote class=q>
<p><span>&#x275D;</span> Certitude is not the test of certainty. We have been cocksure of many things that were not so. <span>&#x275E;</span><br>&mdash; <a href=http://en.wikiquote.org/wiki/Oliver_Wendell_Holmes,_Jr.>Oliver Wendell Holmes, Jr.</a>
+1
View File
@@ -13,6 +13,7 @@ th{text-align:left}
</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>&nbsp;<input name=q size=25>&nbsp;<input type=submit name=sa value=Search></div></form>
<p>You are here: <a href=index.html>Home</a> <span>&#8227;</span> <a href=table-of-contents.html#your-first-python-program>Dive Into Python 3</a> <span>&#8227;</span>
<p id=level title=novice>Difficulty level: <span>&#x2666;</span><span>&#x2662;</span><span>&#x2662;</span><span>&#x2662;</span><span>&#x2662;</span>
<h1>Your First Python Program</h1>
<blockquote class=q>
<p><span>&#x275D;</span> Don&#8217;t bury your burden in saintly silence. You have a problem? Great. Rejoice, dive in, and investigate. <span>&#x275E;</span><br>&mdash; <a href=http://en.wikiquote.org/wiki/Buddhism>Ven. Henepola Gunaratana</a>