🕷️ Crawler Inspector

URL Lookup

Direct Parameter Lookup

Raw Queries and Responses

1. Shard Calculation

Query:
Response:
Calculated Shard: 71 (from laksa041)

2. Crawled Status Check

Query:
Response:

3. Robots.txt Check

Query:
Response:

4. Spam/Ban Check

Query:
Response:

5. Seen Status Check

ℹ️ Skipped - page is already crawled

đź“„
INDEXABLE
âś…
CRAWLED
10 days ago
🤖
ROBOTS ALLOWED

Page Info Filters

FilterStatusConditionDetails
HTTP statusPASSdownload_http_code = 200HTTP 200
Age cutoffPASSdownload_stamp > now() - 6 MONTH0.3 months ago
History dropPASSisNull(history_drop_reason)No drop reason
Spam/banPASSfh_dont_index != 1 AND ml_spam_score = 0ml_spam_score=0
CanonicalPASSmeta_canonical IS NULL OR = '' OR = src_unparsedNot set

Page Details

PropertyValue
URLhttps://realpython.com/videos/python-metaclasses-overview/
Last Crawled2026-04-14 13:01:54 (10 days ago)
First Indexed2024-10-31 18:49:28 (1 year ago)
HTTP Status Code200
Content
Meta TitleMetaclasses in Python (Overview) (Video) – Real Python
Meta DescriptionWelcome to Python Metaclasses. My name is Chris, and I will be your guide. This course is about a tiny little corner of Python, how the machinery behind classes work and how you can hook it. This course is not for the faint of heart, and you could…
Meta Canonicalnull
Boilerpipe Text
In Python, everything is an object, even the classes that create objects. You used a class to instantiate an object instance, but classes themselves are also instantiated behind the scenes. This mechanism is available to you as a programmer through the concept of metaclasses. Metaclasses allow you to hook when classes are created, and this technique is what’s behind magical frameworks like Django and SQLAlchemy where class definitions have side effects that impact databases. In this course you’ll learn about how: Everything really is an object, including classes themselves The type() function works Classes instantiate objects and get instantiated themselves You can hook class instantiation with the metaclass argument Metaclasses aren’t for the faint of heart, but they do allow you to do some magic. Plus, learning about them can help you understand what exactly happens behind the scenes when you instantiate a class. 00:00 Welcome to Python Metaclasses. My name is Chris, and I will be your guide. This course is about a tiny little corner of Python, how the machinery behind classes work and how you can hook it. 00:11 This course is not for the faint of heart, and you could go your entire programming career without ever using any of it. If you’re curious about how classes get instantiated or are interested in writing frameworks where a lot of magical things happen behind the scenes, this course might be for you. 00:29 To get the full picture of a metaclass, first, you need to understand how everything—and I mean everything, including classes—in Python is an object, what the type() function does, how classes instantiate objects, how classes—which are objects—get instantiated, and how to hook that for fame and profit. All right, maybe not fame and profit. 00:53 How about esoteric code goodness instead? 00:58 This course was tested using Python 3.11.2. Most of the concepts introduced here have been around for a while. If you’re using Python 3.7 or later, you should be good. 01:09 Although metaclasses do exist in Python 2 after 2.2, the syntax for it is significantly different. I’ll be sticking with Python 3 throughout the course. 01:21 You’ll be tired of me saying it by the end of the course, but everything, including classes, in Python is an object. When you create a class, you are implicitly instantiating it, and the underlying mechanism used by Python to do this is available to you as a programmer. This can get a little tricky. 01:39 You’re creating things that create things, and that level of abstraction can warp the mind a little bit. Three cases where metaclasses are used are: A factory pattern, where the creation of an object is supposed to have a side effect, like registering it with a central store. Singletons, where you absolutely, positively only want a single instance of an object. 02:00 You can enforce that using a metaclass by controlling how the class instantiates objects. And frameworks like Django and SQLAlchemy that use metaclasses to perform the magic relationship between ORM object attributes and database tables. In fact, the Python standard library uses metaclasses to implement the Enum class. 02:21 Once I’ve covered the concept of metaclasses with you, I’ll walk you through Enum and its companion, the EnumType , to show you a real-world use case. 02:31 Before going all meta, you’ll need to understand the intricacies of classes and the type() function. That’s what’s next.
Markdown
[![Real Python](https://realpython.com/static/real-python-logo.893c30edea53.svg)](https://realpython.com/) - [Start Here](https://realpython.com/start-here/) - [Learn Python](https://realpython.com/videos/python-metaclasses-overview/) [Python Tutorials → In-depth articles and video courses](https://realpython.com/search?kind=article&kind=course&order=newest) [Learning Paths → Guided study plans for accelerated learning](https://realpython.com/learning-paths/) [Quizzes & Exercises → Check your learning progress](https://realpython.com/quizzes/) [Browse Topics → Focus on a specific area or skill level](https://realpython.com/tutorials/all/) [Community Chat → Learn with other Pythonistas](https://realpython.com/community/) [Office Hours → Live Q\&A calls with Python experts](https://realpython.com/office-hours/) [Live Courses → Live, instructor-led Python courses](https://realpython.com/live/) [Podcast → Hear what’s new in the world of Python](https://realpython.com/podcasts/rpp/) [Books → Round out your knowledge and learn offline](https://realpython.com/products/books/) [Reference → Concise definitions for common Python terms](https://realpython.com/ref/) [Code Mentor →Beta Personalized code assistance & learning tools](https://realpython.com/mentor/) [Unlock All Content →](https://realpython.com/account/join/) - [More](https://realpython.com/videos/python-metaclasses-overview/) [Learner Stories](https://realpython.com/learner-stories/) [Python Newsletter](https://realpython.com/newsletter/) [Python Job Board](https://www.pythonjobshq.com/) [Meet the Team](https://realpython.com/team/) [Become a Contributor](https://realpython.com/jobs/) - [Search](https://realpython.com/search "Search") - [Join](https://realpython.com/account/join/) - [Sign‑In](https://realpython.com/account/login/?next=%2Fvideos%2Fpython-metaclasses-overview%2F) Exit Fullscreen # Metaclasses in Python (Overview) [![Christopher Trudeau](https://realpython.com/cdn-cgi/image/width=1174,height=1174,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/headshot_alt_crop.4769ad082e9a.jpeg)](https://realpython.com/courses/python-metaclasses/#team) **[Metaclasses in Python](https://realpython.com/courses/python-metaclasses/)** [Christopher Trudeau](https://realpython.com/courses/python-metaclasses/#team) 02:39 Mark as Completed Supporting Material [Recommended Tutorial](https://realpython.com/python-metaclasses/) [Course Slides (PDF)](https://realpython.com/courses/python-metaclasses/downloads/python-metaclasses-slides/) [Sample Code (ZIP)](https://realpython.com/courses/python-metaclasses/downloads/python-metaclasses-code/) [Ask a Question](https://realpython.com/videos/python-metaclasses-overview/#discussion) - [Contents](https://realpython.com/videos/python-metaclasses-overview/#description) - [Transcript](https://realpython.com/videos/python-metaclasses-overview/#transcript) - [Discussion](https://realpython.com/videos/python-metaclasses-overview/#discussion) In Python, everything is an object, even the classes that create objects. You used a class to instantiate an object instance, but classes themselves are also instantiated behind the scenes. This mechanism is available to you as a programmer through the concept of metaclasses. Metaclasses allow you to hook when classes are created, and this technique is what’s behind magical frameworks like Django and SQLAlchemy where class definitions have side effects that impact databases. **In this course you’ll learn about how:** - Everything really is an object, including classes themselves - The `type()` function works - Classes instantiate objects and get instantiated themselves - You can hook class instantiation with the metaclass argument Metaclasses aren’t for the faint of heart, but they do allow you to do some magic. Plus, learning about them can help you understand what exactly happens behind the scenes when you instantiate a class. **Download** [Sample Code (ZIP)](https://realpython.com/courses/python-metaclasses/downloads/python-metaclasses-code/) 21\.2 KB **Download** [Course Slides (PDF)](https://realpython.com/courses/python-metaclasses/downloads/python-metaclasses-slides/) 1\.0 MB [**00:00**](https://realpython.com/videos/python-metaclasses-overview/#t=0.52) [Welcome to Python Metaclasses. My name is Chris, and I will be your guide.](https://realpython.com/videos/python-metaclasses-overview/#t=0.52) [This course is about a tiny little corner of Python,](https://realpython.com/videos/python-metaclasses-overview/#t=4.67) [how the machinery behind classes work and how you can hook it.](https://realpython.com/videos/python-metaclasses-overview/#t=7.54) [**00:11**](https://realpython.com/videos/python-metaclasses-overview/#t=11.47) [This course is not for the faint of heart,](https://realpython.com/videos/python-metaclasses-overview/#t=11.47) [and you could go your entire programming career without ever using any of it.](https://realpython.com/videos/python-metaclasses-overview/#t=13.94) [If you’re curious about how classes get instantiated or are interested in](https://realpython.com/videos/python-metaclasses-overview/#t=18.46) [writing frameworks where a lot of magical things happen behind the scenes,](https://realpython.com/videos/python-metaclasses-overview/#t=22.6) [this course might be for you.](https://realpython.com/videos/python-metaclasses-overview/#t=26.19) [**00:29**](https://realpython.com/videos/python-metaclasses-overview/#t=29.88) [To get the full picture of a metaclass, first,](https://realpython.com/videos/python-metaclasses-overview/#t=29.88) [you need to understand how everything—and I mean everything,](https://realpython.com/videos/python-metaclasses-overview/#t=32.44) [including classes—in Python is an object, what the `type()` function does,](https://realpython.com/videos/python-metaclasses-overview/#t=35.93) [how classes instantiate objects,](https://realpython.com/videos/python-metaclasses-overview/#t=41.82) [how classes—which are objects—get instantiated, and how to hook that](https://realpython.com/videos/python-metaclasses-overview/#t=44.84) [for fame and profit. All right, maybe not fame and profit.](https://realpython.com/videos/python-metaclasses-overview/#t=49.73) [**00:53**](https://realpython.com/videos/python-metaclasses-overview/#t=53.81) [How about esoteric code goodness instead?](https://realpython.com/videos/python-metaclasses-overview/#t=53.81) [**00:58**](https://realpython.com/videos/python-metaclasses-overview/#t=58.7) [This course was tested using Python 3.11.2.](https://realpython.com/videos/python-metaclasses-overview/#t=58.7) [Most of the concepts introduced here have been around for a while.](https://realpython.com/videos/python-metaclasses-overview/#t=62.86) [If you’re using Python 3.7 or later, you should be good.](https://realpython.com/videos/python-metaclasses-overview/#t=65.97) [**01:09**](https://realpython.com/videos/python-metaclasses-overview/#t=69.83) [Although metaclasses do exist in Python 2 after 2.2,](https://realpython.com/videos/python-metaclasses-overview/#t=69.83) [the syntax for it is significantly different.](https://realpython.com/videos/python-metaclasses-overview/#t=74.17) [I’ll be sticking with Python 3 throughout the course.](https://realpython.com/videos/python-metaclasses-overview/#t=76.65) [**01:21**](https://realpython.com/videos/python-metaclasses-overview/#t=81.87) [You’ll be tired of me saying it by the end of the course,](https://realpython.com/videos/python-metaclasses-overview/#t=81.87) [but everything, including classes, in Python is an object.](https://realpython.com/videos/python-metaclasses-overview/#t=84.43) [When you create a class, you are implicitly instantiating it,](https://realpython.com/videos/python-metaclasses-overview/#t=88.56) [and the underlying mechanism used by Python to do this is available to you as a](https://realpython.com/videos/python-metaclasses-overview/#t=91.95) [programmer. This can get a little tricky.](https://realpython.com/videos/python-metaclasses-overview/#t=96.33) [**01:39**](https://realpython.com/videos/python-metaclasses-overview/#t=99.49) [You’re creating things that create things,](https://realpython.com/videos/python-metaclasses-overview/#t=99.49) [and that level of abstraction can warp the mind a little bit.](https://realpython.com/videos/python-metaclasses-overview/#t=102.01) [Three cases where metaclasses are used are: A factory pattern, where the creation](https://realpython.com/videos/python-metaclasses-overview/#t=105.76) [of an object is supposed to have a side effect,](https://realpython.com/videos/python-metaclasses-overview/#t=110.63) [like registering it with a central store. Singletons, where you absolutely,](https://realpython.com/videos/python-metaclasses-overview/#t=112.66) [positively only want a single instance of an object.](https://realpython.com/videos/python-metaclasses-overview/#t=117.71) [**02:00**](https://realpython.com/videos/python-metaclasses-overview/#t=120.85) [You can enforce that using a metaclass by controlling how the class](https://realpython.com/videos/python-metaclasses-overview/#t=120.85) [instantiates objects. And frameworks like Django and SQLAlchemy](https://realpython.com/videos/python-metaclasses-overview/#t=123.79) [that use metaclasses to perform the magic relationship between ORM object](https://realpython.com/videos/python-metaclasses-overview/#t=128.91) [attributes and database tables. In fact,](https://realpython.com/videos/python-metaclasses-overview/#t=133.0) [the Python standard library uses metaclasses to implement the `Enum` class.](https://realpython.com/videos/python-metaclasses-overview/#t=136.32) [**02:21**](https://realpython.com/videos/python-metaclasses-overview/#t=141.08) [Once I’ve covered the concept of metaclasses with you,](https://realpython.com/videos/python-metaclasses-overview/#t=141.08) [I’ll walk you through `Enum` and its companion,](https://realpython.com/videos/python-metaclasses-overview/#t=143.76) [the `EnumType`, to show you a real-world use case.](https://realpython.com/videos/python-metaclasses-overview/#t=146.27) [**02:31**](https://realpython.com/videos/python-metaclasses-overview/#t=151.69) [Before going all meta,](https://realpython.com/videos/python-metaclasses-overview/#t=151.69) [you’ll need to understand the intricacies of classes and the `type()` function.](https://realpython.com/videos/python-metaclasses-overview/#t=153.05) [That’s what’s next.](https://realpython.com/videos/python-metaclasses-overview/#t=156.93) [Become a Member](https://realpython.com/account/join/) to join the conversation. Course Contents [Overview](https://realpython.com/courses/python-metaclasses/) 14% © 2012–2026 Real Python ⋅ [Privacy Policy](https://realpython.com/privacy-policy/) ![](https://www.facebook.com/tr?id=2220911568135371&ev=PageView&noscript=1)
Readable Markdown
In Python, everything is an object, even the classes that create objects. You used a class to instantiate an object instance, but classes themselves are also instantiated behind the scenes. This mechanism is available to you as a programmer through the concept of metaclasses. Metaclasses allow you to hook when classes are created, and this technique is what’s behind magical frameworks like Django and SQLAlchemy where class definitions have side effects that impact databases. **In this course you’ll learn about how:** - Everything really is an object, including classes themselves - The `type()` function works - Classes instantiate objects and get instantiated themselves - You can hook class instantiation with the metaclass argument Metaclasses aren’t for the faint of heart, but they do allow you to do some magic. Plus, learning about them can help you understand what exactly happens behind the scenes when you instantiate a class. [**00:00**](https://realpython.com/videos/python-metaclasses-overview/#t=0.52) [Welcome to Python Metaclasses. My name is Chris, and I will be your guide.](https://realpython.com/videos/python-metaclasses-overview/#t=0.52) [This course is about a tiny little corner of Python,](https://realpython.com/videos/python-metaclasses-overview/#t=4.67) [how the machinery behind classes work and how you can hook it.](https://realpython.com/videos/python-metaclasses-overview/#t=7.54) [**00:11**](https://realpython.com/videos/python-metaclasses-overview/#t=11.47) [This course is not for the faint of heart,](https://realpython.com/videos/python-metaclasses-overview/#t=11.47) [and you could go your entire programming career without ever using any of it.](https://realpython.com/videos/python-metaclasses-overview/#t=13.94) [If you’re curious about how classes get instantiated or are interested in](https://realpython.com/videos/python-metaclasses-overview/#t=18.46) [writing frameworks where a lot of magical things happen behind the scenes,](https://realpython.com/videos/python-metaclasses-overview/#t=22.6) [this course might be for you.](https://realpython.com/videos/python-metaclasses-overview/#t=26.19) [**00:29**](https://realpython.com/videos/python-metaclasses-overview/#t=29.88) [To get the full picture of a metaclass, first,](https://realpython.com/videos/python-metaclasses-overview/#t=29.88) [you need to understand how everything—and I mean everything,](https://realpython.com/videos/python-metaclasses-overview/#t=32.44) [including classes—in Python is an object, what the `type()` function does,](https://realpython.com/videos/python-metaclasses-overview/#t=35.93) [how classes instantiate objects,](https://realpython.com/videos/python-metaclasses-overview/#t=41.82) [how classes—which are objects—get instantiated, and how to hook that](https://realpython.com/videos/python-metaclasses-overview/#t=44.84) [for fame and profit. All right, maybe not fame and profit.](https://realpython.com/videos/python-metaclasses-overview/#t=49.73) [**00:53**](https://realpython.com/videos/python-metaclasses-overview/#t=53.81) [How about esoteric code goodness instead?](https://realpython.com/videos/python-metaclasses-overview/#t=53.81) [**00:58**](https://realpython.com/videos/python-metaclasses-overview/#t=58.7) [This course was tested using Python 3.11.2.](https://realpython.com/videos/python-metaclasses-overview/#t=58.7) [Most of the concepts introduced here have been around for a while.](https://realpython.com/videos/python-metaclasses-overview/#t=62.86) [If you’re using Python 3.7 or later, you should be good.](https://realpython.com/videos/python-metaclasses-overview/#t=65.97) [**01:09**](https://realpython.com/videos/python-metaclasses-overview/#t=69.83) [Although metaclasses do exist in Python 2 after 2.2,](https://realpython.com/videos/python-metaclasses-overview/#t=69.83) [the syntax for it is significantly different.](https://realpython.com/videos/python-metaclasses-overview/#t=74.17) [I’ll be sticking with Python 3 throughout the course.](https://realpython.com/videos/python-metaclasses-overview/#t=76.65) [**01:21**](https://realpython.com/videos/python-metaclasses-overview/#t=81.87) [You’ll be tired of me saying it by the end of the course,](https://realpython.com/videos/python-metaclasses-overview/#t=81.87) [but everything, including classes, in Python is an object.](https://realpython.com/videos/python-metaclasses-overview/#t=84.43) [When you create a class, you are implicitly instantiating it,](https://realpython.com/videos/python-metaclasses-overview/#t=88.56) [and the underlying mechanism used by Python to do this is available to you as a](https://realpython.com/videos/python-metaclasses-overview/#t=91.95) [programmer. This can get a little tricky.](https://realpython.com/videos/python-metaclasses-overview/#t=96.33) [**01:39**](https://realpython.com/videos/python-metaclasses-overview/#t=99.49) [You’re creating things that create things,](https://realpython.com/videos/python-metaclasses-overview/#t=99.49) [and that level of abstraction can warp the mind a little bit.](https://realpython.com/videos/python-metaclasses-overview/#t=102.01) [Three cases where metaclasses are used are: A factory pattern, where the creation](https://realpython.com/videos/python-metaclasses-overview/#t=105.76) [of an object is supposed to have a side effect,](https://realpython.com/videos/python-metaclasses-overview/#t=110.63) [like registering it with a central store. Singletons, where you absolutely,](https://realpython.com/videos/python-metaclasses-overview/#t=112.66) [positively only want a single instance of an object.](https://realpython.com/videos/python-metaclasses-overview/#t=117.71) [**02:00**](https://realpython.com/videos/python-metaclasses-overview/#t=120.85) [You can enforce that using a metaclass by controlling how the class](https://realpython.com/videos/python-metaclasses-overview/#t=120.85) [instantiates objects. And frameworks like Django and SQLAlchemy](https://realpython.com/videos/python-metaclasses-overview/#t=123.79) [that use metaclasses to perform the magic relationship between ORM object](https://realpython.com/videos/python-metaclasses-overview/#t=128.91) [attributes and database tables. In fact,](https://realpython.com/videos/python-metaclasses-overview/#t=133.0) [the Python standard library uses metaclasses to implement the `Enum` class.](https://realpython.com/videos/python-metaclasses-overview/#t=136.32) [**02:21**](https://realpython.com/videos/python-metaclasses-overview/#t=141.08) [Once I’ve covered the concept of metaclasses with you,](https://realpython.com/videos/python-metaclasses-overview/#t=141.08) [I’ll walk you through `Enum` and its companion,](https://realpython.com/videos/python-metaclasses-overview/#t=143.76) [the `EnumType`, to show you a real-world use case.](https://realpython.com/videos/python-metaclasses-overview/#t=146.27) [**02:31**](https://realpython.com/videos/python-metaclasses-overview/#t=151.69) [Before going all meta,](https://realpython.com/videos/python-metaclasses-overview/#t=151.69) [you’ll need to understand the intricacies of classes and the `type()` function.](https://realpython.com/videos/python-metaclasses-overview/#t=153.05) [That’s what’s next.](https://realpython.com/videos/python-metaclasses-overview/#t=156.93)
ML Classification
ML Categories
/Computers_and_Electronics
93.7%
/Computers_and_Electronics/Programming
88.8%
/Computers_and_Electronics/Programming/Scripting_Languages
85.2%
/Jobs_and_Education
11.1%
/Jobs_and_Education/Education
11.1%
/Jobs_and_Education/Education/Computer_Education
10.5%
Raw JSON
{
    "/Computers_and_Electronics": 937,
    "/Computers_and_Electronics/Programming": 888,
    "/Computers_and_Electronics/Programming/Scripting_Languages": 852,
    "/Jobs_and_Education": 111,
    "/Jobs_and_Education/Education": 111,
    "/Jobs_and_Education/Education/Computer_Education": 105
}
ML Page Types
/Video
85.6%
/Video/Tutorial_or_Guide
85.2%
Raw JSON
{
    "/Video": 856,
    "/Video/Tutorial_or_Guide": 852
}
ML Intent Types
Informational
99.6%
Raw JSON
{
    "Informational": 996
}
Content Metadata
Languageen
AuthorReal Python
Publish Timenot set
Original Publish Time2024-10-31 18:49:28 (1 year ago)
RepublishedNo
Word Count (Total)803
Word Count (Content)569
Links
External Links2
Internal Links38
Technical SEO
Meta NofollowNo
Meta NoarchiveNo
JS RenderedYes
Redirect Targetnull
Performance
Download Time (ms)157
TTFB (ms)157
Download Size (bytes)10,819
Shard71 (laksa)
Root Hash13351397557425671
Unparsed URLcom,realpython!/videos/python-metaclasses-overview/ s443