You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: materials/source/notes/session08.rst
+25-2Lines changed: 25 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,8 @@ Matthew Sachio Maeda
18
18
19
19
Morgan Heinemann
20
20
21
+
Let's take a look at the past lightning talks list -- make sure we haven't missed anyone.
22
+
21
23
22
24
Issues that came up during the week.
23
25
====================================
@@ -58,16 +60,37 @@ I know I started out that way -- 'cause there wasn't anything else to test. But
58
60
59
61
60
62
Do you always need an __init__?
61
-
------------------------------
63
+
-------------------------------
62
64
63
65
No -- you don't :-)
64
66
65
-
The ONLY thing "special" about __init__ is that it is automatically called when and instance is created. Other than that, it's a regular method. So if you don't define one, then the superclass' __init__ will be called.
67
+
The ONLY thing "special" about __init__ is that it is automatically called when an instance is created. Other than that, it's a regular method. So if you don't define one, then the superclass' __init__ will be called.
66
68
67
69
That's what inheritance is all about -- the subclass inherits ALL the superclasses methods -- including __init__.
68
70
69
71
So never write an __init__ that does nothing but call the superclass __init__
70
72
73
+
Subclasses and ``self``
74
+
-----------------------
75
+
76
+
``self`` is the first parameter in all methods. But why??
77
+
78
+
``self`` is the "current" instance of the object. This means that you don't know at code writing time what type it is -- is it the current class? some subclass?
0 commit comments