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): ②
docstrings too, just like modules and functions.
__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.