Intro to Object-Oriented Python
Posted on Nov 1st, 2021
Today, we’ll take a brief survey of classes and objects in Python to get us ready to take on Django.
Today’s topics
- Python Classes
- Instantiating an Object
- Attributes
- Instance Methods
- “Magic” Methods
🔎 Mystery Word Project Retrospective
- Something I learned by doing this project is…
- Something I want to understand better or know more about is…
- In this project, I was happy that I was able to…
🐍 Code Break
🎯 Project
Today you are taking the code you wrote for the word frequency project and refactoring it using OO programming.
🔖 Resources
- Real Python - Object-Oriented Programming in Python 3
- A Byte of Python: OO
- Python Docs: Classes
- Inheritance and Composition in Python OO
- OO-Programming – This is a chapter from a book called Beyond the Basic Stuff With Python by Al Sweigart. He has written a ton of great books on Python and makes them available to read for free online at inventwithpython.com. You might check out Automate the Boring Stuff with Python. It’s a fantastic beginner book.
- Special Methods (aka magic methods) in the Python Docs
- A Guide to Python’s Magic Methods This is a great reference, but watch out! It was written for Python 2, so a few things may be different in Python 3.
- Scope of Variables in Python
- 🐛 Debugging Python For Fun & Profit (video)
- Code Style Checks in Python We installed
flake8
on the first day of this phase. This post gives you some detail about what it’s for and why you need it.
🦉 Code
- Jupyter Notebooks Notebooks 14-15