
Master modern Python and object-oriented concepts with Python 3.7+, including data classes and enumerations. Set up PyCharm or lightweight editors, plus Jupyter-like tools such as Datalore or Colab.
Explore Python's PEP 8, the official style guide for code, and learn how readability, maintainability, and clean documented code boost productivity and collaboration.
Define a Python class using the class statement, follow CamelCase naming, and recognize that a class is a blueprint with state and behavior; calling it creates distinct instances.
Set and modify class state by binding attributes inside and outside the class body, access class dict via dunder dict, and note that all instances share these blueprint-defined values.
Learn how to add behavior to a Python class by defining instance methods with self, and see how methods bind to specific instances.
Learn to access and set object attributes with getattr and setattr as alternatives to dot syntax at scale for programmatic attribute management.
Define a student class with name and age attributes, and allow name-only instantiation via a class attribute platform defaulting to Udemy. Include a grid method that randomly greets from names.
Learn Python object oriented programming by building a student class with a class attribute and instance attributes, a greet and grid method, and a helper to create instances from names.
Learn how each object stores attributes in a per-instance mapping called __dict__, creating separate namespaces for m1 and m2, while dot access mirrors direct dictionary binding.
Explore how class variables define shared attributes and why mutable class variables can create unintended cross-instance changes; learn to avoid this with immutability and proper bindings.
Define dunder __eq__ to customize class equality, and consider __ne__ for non-equality, noting that in modern Python __ne__ is not automatically the negation of __eq__ under builtins inheritance.
Make the book class hashable by implementing __eq__ and __hash__ using (title, author). Hash values are not meaningful across processes and should align with equality.
Understand how changing attributes can alter an object's hash and break dictionary lookups, and learn how making attributes read-only ensures a stable hash across an instance's life.
Discover how the functools.total_ordering decorator simplifies Python rich comparisons by defining only __eq__ and one of __lt__, __gt__, __le__, or __ge__, to enable all comparison operators.
Explore operator overloading in Python by implementing dunder add and radd on a bookshelf class to support plus and plus-equals with books, returning new shelves without mutation.
Explore building a 3d vector class with x, y, z coordinates, supporting magnitude calculation, vector addition, scalar multiplication, comparisons, hashing, and case-insensitive bracket access for coordinates.
Learn how properties enable validating loyalty levels and membership years in a Python OOP class without breaking client code, keeping dot notation and backward compatibility.
Dna base class accepts a nucleotide input as the name or first letter (A, C, G, T), case-insensitive, validates and standardizes to the lowercase name, raising exceptions on invalid values.
Learn decorator syntax for python properties, using a getter and setter named like the property to create a clean, equivalent alternative to the built-in property approach, illustrated with loyalty.
Defines a tablet class with light, pro, and max models. Assigns default base memory and storage per model, validates input, and exposes storage via add and read-only properties.
Leverage inheritance to derive new classes from existing ones, reusing attributes and behaviors, and form is-a hierarchies like virus, RNA virus, coronavirus, and SARS-CoV-2, via single inheritance.
All Python classes implicitly inherit from object, the base class, making virus-like subclasses callable and able to use default behaviors such as representation and equality, while allowing overrides for customization.
Explore the method resolution order and attribute lookup rules in Python, detailing how the instance, class, and superclasses determine attribute access and how dunder bases and mro expose the chain.
Use Python's super to delegate to the parent, enabling indirect access to the parent’s reproduce method and improving maintainability during refactors, with implications for single versus multiple inheritance.
Develop a bank account hierarchy with an initial balance, deposit and withdraw methods for positive amounts, then add savings, high-interest savings, and locked-in accounts with interest and withdrawal fees.
Extend python built-ins by subclassing dict to customize key lookup behavior. Override __getitem__ to replace key errors with random not found messages, demonstrating inherited behavior and selective customization.
Explore how to build a bi directional dictionary in Python that enables two ways lookups, maintains unique non mirrored key value pairs, and propagates updates and removals to mirrors.
Create a bidirectional dict with two-way lookup by mirroring bindings and keeping them in sync, using a collections wrapper instead of inheriting dict, and supporting mirrored pop, update, and deletion.
Review how instance attributes are stored in Python, compare the instance dictionary with the class namespace, and explain how slots optimize memory and speed by restricting attributes.
Define slots as a class attribute to enable memory and speed optimizations by using a fixed length array instead of a dictionary, then map each attribute to a specific index.
Define a slots class attribute to remove the per-instance __dict__, making all instances lose dicts. Including __dict__ in slotted attributes preserves dicts but adds noticeable performance overhead.
Define a three-dimensional point with x, y, z via slots, extend with inheritance to colored point and shape point, and implement a wrapper to recreate instances.
Define a 3d point class with x, y, z slots and subclasses color point and shape point; override init for keyword args and implement wrappers to recreate instances.
Named tuples are immutable; reassigning attributes raises an exception. The lecture explains that lists are reference types and suggests using tuples, frozen lists, or data classes for deep immutability.
Introduce data classes, added in Python 3.7, to store state rather than behavior by decorating a class with the dataclass decorator from the dataclasses module and reduce boilerplate.
Learn how Python type hints guide editors and readers, with data class fields requiring annotations, while runtime remains dynamic and tools like mypy enforce typing.
Explore how data classes become immutable by using frozen, making instances hashable, and controlling which fields participate in the hash, so they can serve as dictionary keys or set members.
Compare named tuples and data classes to choose the tool for Python object oriented programming. Named tuples are immutable, value-based tuples, while data classes are flexible, extensible classes with defaults.
Explore Python's attribute lookup chain from instance and class dictionaries through the inheritance hierarchy. Learn how descriptors alter lookups and when Python raises attribute errors.
Use per-instance storage for descriptor values to prevent shared state across objects. Consider hashability, memory leaks, and alternatives like id-based keys or weak key dictionaries from weakref.
Store descriptor fields per instance in the instance dictionary to align storage with the object lifecycle and avoid memory management pitfalls.
Master Python descriptors by clarifying self, owner, and instance in the descriptor protocol, and guard against none when accessed from the class.
Explore how properties and descriptors validate type and length, compare reuse and scalability, and reveal why descriptors excel for project-wide consistency while properties suit single-attribute use.
Explore how properties and descriptors connect in Python, comparing decorator syntax with the property built-in. See how a class attribute maps to a descriptor like TextField through the descriptor protocol.
Define a student profile class with name, GRE score, and SAT score, validate scores within GRE and SAT ranges, default 130 and 400, using descriptors for storage and eval-friendly representation.
Explore Python object oriented programming by using data descriptors to validate and bind attributes such as SAT score and city, enforcing type checks and value ranges.
Enumerations in Python, added in 3.4, define a class inheriting from the enum metaclass to map static values to a single variable, offering immutability, iterability, and hashability.
Python enums require unique symbolic names, but multiple names can share the same value as aliases; the first member is the master, and all later aliases point to it.
Learn how to customize Python enum auto values by implementing generate_next_value, override before member definitions, and use a base class to keep enums simple while returning custom objects.
In Python, enums are full types that act like classes and can be extended with new behavior; they are iterable and expose values, but enums with members cannot be subclassed.
Discover how bitwise operations work on binary representations, using and, or, and xor, and see how eight bits form a byte and drive modern computing.
Implement a permission system with a read, write, execute enumeration and bitwise support. Define a user class that assigns permissions by role and supports creation via string or integer inputs.
Raise exceptions with the raise keyword, raise from within a try block, and use handlers to enforce business logic, such as detecting zero quantity in a portfolio.
Explore how syntax errors differ from other exceptions: they cannot be caught because they stop compilation to bytecode, while other exceptions can be handled during interpretation.
Explore how the else clause runs only when no exception occurs in the try block, after except handlers, and practice decoding json payloads with error handling.
Discover how the finally block guarantees cleanup code runs after a try, regardless of exceptions or returns, and why using with statements for files is the pythonic alternative.
Define custom exceptions by subclassing base exception to build a domain-specific hierarchy that fits your program, enabling precise handling and integration with Python’s exception propagation flow.
Welcome to the best resource online and the only one you need to learn and master object-oriented programming with modern python!
There has never been a better time to learn python. It is consistently ranked in the top 3 most in-demand and most-loved programming languages in the world, with applications in machine learning, web development, data science, automation, game development, and much more. And its growth shows no signs of stopping.
But while there are plenty of resources to learn the basics of python, it is quite difficult to move past those to the intermediate and advanced facets of the language. This course seeks to address that.
Over more than 20 hours of detailed lectures, live coding, and guided projects we will unpack everything that python has to offer, starting from absolute scratch. We will master not only object-oriented python and how to use it, but in the process also gain an understanding of the python data model and the essence of writing pythonic code.
Every five to ten lectures we will stop and practice what we have covered, as we work through a list of detailed requirements and convert that to an object-oriented solution using nothing by zero-dependencies, pure python.
––––– Structure & Curriculum –––––
The curriculum is organized around three parts of increasing target proficiency.
In the first, we will cover the essential foundations of working with classes in python, defining our own types, customizing them using dunders, exposing managed attributes through properties and effectively using inheritance.
· Classes
· Dunders
· Properties
· Inheritance
Having established that core foundation, in the next five sections, we will dive into more advanced topics that effective python developers rely on. These include modern features like dataclasses, enumerations and slots but also more established, pivotal constructs like descriptors and exceptions.
· Slots
· Dataclasses
· Descriptors
· Enumerations
· Exceptions
Then in the final four sections we will take a look under the hood at how python recognizes and works with types. We will explore, practice and implement several patterns including duck typing, dynamic protocols and abstract base classes. Finally, we will look at the internal machinery that produces classes in python, as we turn our attention to class metaprogramming.
· Dynamic Protocols
· Abstract Base Classes
· Multiple Inheritance
· Class Metaprogramming
This course is intended for anyone who is committed to mastering object-oriented programming with python, regardless of prior experience, which is why a full-length bonus introduction to the python programming language is included to get anyone up and running writing pythonic code in no time.
I hope you commit to joining me in this journey as we take your python to the next level. See you inside!