Python Data Model

Magic Methods in Python Classes12 H 44 M

Just you? Training a whole team? There's an ITProTV plan that fits.

Start Training Today
  • Basics
    • Overview
    • Creating and Initializing an Instance
    • Representing an Instance: str and repr
    • Representing an Instance: format
    • Representing an Instance: bytes
    • Deleting an Instance
  • Containers
    • Objects as Iterables
    • Getting Items
    • Setting and Deleting Items
  • Comparables
    • Obtaining the Boolean Representation
    • Equality and Inequality
    • Greater and Less
    • Hashing and Slots
  • Numbers
    • Adding
    • Subtracting
    • Multiplying
    • Dividing
    • Modulo and Powers
    • Bit Shifting Operations
    • Bitwise Logical Operations
    • Negative and Positive
    • Absolute Value and Inverse
    • Integers and Floats
    • Rounding
    • Floor and Ceiling
    • Truncation and Indexing
    • Complex Number
  • Attributes
    • Getting Attributes
    • Setting and Deleting Attributes
    • Descriptors: Property Decorators
    • Descriptors: Creating a Custom Descriptor
  • Functions
    • Making an Object Callable
  • Context Managers
    • Clean Up with Context Managers
  • Serialization
    • Copying Objects
    • Pickling: Get and Set State


2 M

itprotv course thumbnailitprotv course thumbnailitprotv course thumbnail
  • Episode Description
  • Transcript

Python has a set of protocols that the language internally adhere to which provides the functionality for features such as iteration, context manager behavior, string representation of an object, and many other things. When you create custom classes in Python and make use of these protocols then you can create custom behavior in the context of iterations, types, comparison of objects, operator overloading, and much more. Knowing about these will help level up your Python skills. If you are ready to progress forward in your Python prowess, then join us to learn more about the Python data model.

[MUSIC] In this segment we are gonna take a few minutes to briefly overlook what you can expect from the upcoming Python Data Model series. Justin if you would be so kind to give us some idea of the the topics that we are gonna cover in that series. >> So this series is meant to really up your game in Python, right? What are some of these nice, behind the scenes magic that we can now leverage to our own advantage to make our lives a little bit easier, right? Pickling, copying, maybe making a custom object behave like a number, being able to compare custom objects. Maybe actually making sure an object is constructed exactly like you want it. These are all things we're gonna cover in this series. >> Now, Justin a lot of times, we have two different formats here. Typically, we have certification based tracks and we also have technical skills based tracks. Things that we need people to know or people might want to know as a technical type of skill. Which one of those tracks would these series fall under? >> This series is definitely a technical skill, right? The assumption is you know a little bit of Python. You really wanna up your game. It's not that I'm gonna test you at the end or someone else is. But you really want to understand the inner workings of Python. And that's what we're gonna do in this course. And, Justin, also it seems like you're assuming some knowledge when it comes to Python. What should the skill level be for the person that is watching this series? >> I recommend that you've been programming in Python for a little bit. This is probably a more intermediate to intermediate advanced type thing, right? You can get away without knowing any of this in the series for a while in Python. But you should know what a Python class is, how to create a class, a general idea of object oriented programming. As well as, you have spawned Python functions, you've written Python scripts. So I recommend, if you're brand-new to Python, maybe here is not the greatest place to start. >> All right, well, Justin it looks like you've got a lot of stuff on deck for us in this series and it sounds great. And if it sounds great to you we look forward to seeing you in those upcoming episodes. [MUSIC]