From 2f4b9657e716ab04fe9a87c018458eebe42031c6 Mon Sep 17 00:00:00 2001 From: Mark Pilgrim Date: Sat, 16 May 2009 01:11:09 -0400 Subject: [PATCH] validation fiddling --- iterators.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iterators.html b/iterators.html index 6b114c1..2810adc 100644 --- a/iterators.html +++ b/iterators.html @@ -76,7 +76,7 @@ class PapayaWhip: class Fib: """iterator that yields numbers in the Fibanocci sequence""" - def __init__(self, max): + def __init__(self, max):
  1. Classes can (and should) have docstrings too, just like modules and functions.
  2. The __init__() method is called immediately after an instance of the class is created. It would be tempting but incorrect to call this the constructor of the class. It’s tempting, because it looks like a constructor (by convention, the __init__() method is the first method defined for the class), acts like one (it’s the first piece of code executed in a newly created instance of the class), and even sounds like one. Incorrect, because the object has already been constructed by the time the __init__() method is called, and you already have a valid reference to the new instance of the class.