.. _session_1_07: ##################################### Session 7: Object Oriented Programing ##################################### Object Oriented Programing: classes, instance and class attributes, subclassing and inheritance. Pre-class prep ============== **Read:** * :ref:`object_orientation_overview` * :ref:`python_classes` * :ref:`subclassing_inheritance` Supplemental reading -------------------- * Dive into Python3: 7.2 -- 7.3 http://www.diveintopython3.net/iterators.html#defining-classes * Think Python: 15 -- 18 http://www.greenteapress.com/thinkpython/html/thinkpython016.html Some Videos to watch: --------------------- Python Class Toolkit by *Raymond Hettinger* https://youtu.be/HTLu2DFOdTg https://speakerdeck.com/pyconslides/pythons-class-development-toolkit-by-raymond-hettinger The Art of Subclassing by *Raymond Hettinger* http://pyvideo.org/video/879/the-art-of-subclassing The most salient points from that video are as follows: * **Subclassing is not for Specialization** * **Classes and subclassing are for code re-use -- not creating taxonomies** * **Bear in mind that the subclass is in charge** Note that the previous talk and this one were back to back at PyCon -- but despite their contradictory titles -- they have similar messages. Stop Writing Classes .................... by *Jack Diederich* http://pyvideo.org/video/880/stop-writing-classes "If your class has only two methods -- and one of them is ``__init__`` -- you don't need a class" In-class Activities =================== review mailman with testing Exercises: ---------- OO and classes are a big confusing topic when you are new to it. So we're going to learn hands-on by doing this exercise: :ref:`exercise_html_renderer` Post-class Activities ===================== Finish the HTML render Exercise through step 3. Look at the next session for reading, etc: :ref:`session_1_08`