Intro to Object-Oriented Python
Posted on Aug 17th, 2022
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
🔎 Wheel of Fortune 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
DUE MONDAY MORNING:
- Complete at least one of the following tutorials:
- DjangoGirls
- Solid content, friendly language, focused on finishing a complete app and learning the essential parts of a Django app.
- MDN Django Library Tutorial
- Detailed explanations, goes into intermediate topics that aren’t absolutely necessary for building your first app but will be useful.
- DjangoGirls
🔖 Resources
Object-oriented
- Real Python - Object-Oriented Programming in Python 3
- A Byte of Python: OO
- 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.
Classes in Python
- Python Docs: Classes
- Python Docs: Clases
- StackOverflow: How do I design a class in Python?
- Special Methods (aka magic methods) in the Python Docs
- Nombres Especiales de Método
- 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.
Useful resources for debugging
- 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 & Notes
- Jupyter Notebooks Notebooks 13-15
- Blackjack
- Word Frequency OO Version