🕷️ Crawler Inspector

URL Lookup

Direct Parameter Lookup

Raw Queries and Responses

1. Shard Calculation

Query:
Response:
Calculated Shard: 1 (from laksa108)

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
1 day ago
🤖
ROBOTS ALLOWED

Page Info Filters

FilterStatusConditionDetails
HTTP statusPASSdownload_http_code = 200HTTP 200
Age cutoffPASSdownload_stamp > now() - 6 MONTH0 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://betterstack.com/community/questions/what-are-metaclasses-in-python/
Last Crawled2026-04-10 14:34:42 (1 day ago)
First Indexed2023-01-25 07:39:27 (3 years ago)
HTTP Status Code200
Meta TitleWhat are metaclasses in Python? | Better Stack Community
Meta DescriptionAI SRE and MCP server, incident management, on-call, logs, metrics, traces, and error tracking. 7,000+ happy customers. 60-day money back guarantee.
Meta Canonicalnull
Boilerpipe Text
Better Stack Team Updated on January 24, 2023 In Python, a metaclass is the class of a class. It defines how a class behaves, including how it is created and how it manages its instances. A metaclass is defined by inheriting from the built-in type class, and it can define methods that customize the behavior of the class it creates. The class that a metaclass creates is called its "metaclass instance" or simply its "instance." One use of metaclasses is to create singleton classes, classes with only one instance. Here's an example of a simple metaclass that creates a singleton class: Copied! Here, the Singleton metaclass defines a __call__ method that intercepts the creation of new instances of the class it creates. It keeps track of instances it has created in the _instances dictionary, and if an instance of the class already exists, it returns that instance instead of creating a new one. So, every time you create an instance of MySingletonClass , you get the same object. This example is just a simple illustration of what metaclasses can do, and in most cases, this type of requirement could also be achieved by using other design patterns or python inbuilt modules like Singleton from module singleton-decorator` . Got an article suggestion? Let us know Explore more This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Markdown
Platform [AI SRE Agentic root cause analysis](https://betterstack.com/ai-sre) [Incident management & on-call Move fast when things break](https://betterstack.com/incident-management) [Uptime monitoring The most reliable uptime monitoring](https://betterstack.com/uptime) [Status page Communicate downtime & build trust](https://betterstack.com/status-page) [Tracing eBPF-based OpenTelemetry-native tracing](https://betterstack.com/tracing) [Log management Collect insights across your stack](https://betterstack.com/log-management) [Infrastructure monitoring OpenTelemetry-native infrastructure monitoring](https://betterstack.com/infrastructure-monitoring) [Real user monitoring Session replay, web vitals & product analytics](https://betterstack.com/real-user-monitoring) [Error tracking AI‑native error tracking built on Better Stack](https://betterstack.com/error-tracking) [Data warehouse Time series data warehouse as an API](https://betterstack.com/warehouse) [Documentation](https://betterstack.com/docs/) [Pricing](https://betterstack.com/pricing) Company [Work at Better Stack](https://betterstack.com/careers) [Engineering](https://betterstack.com/careers/engineering) [Security](https://betterstack.com/security) [Blog](https://betterstack.com/community/blog) [Changelog](https://betterstack.com/tag/changelog) [Enterprise](https://betterstack.com/enterprise) [Sign in](https://betterstack.com/users/sign-in) [Sign up](https://betterstack.com/users/sign-up) Platform [Documentation](https://betterstack.com/docs/) [Pricing](https://betterstack.com/pricing) Community Company [Enterprise](https://betterstack.com/enterprise) Back [AI SRE Agentic root cause analysis](https://betterstack.com/ai-sre) [Incident management & on-call Move fast when things break](https://betterstack.com/incident-management) [Uptime monitoring The most reliable uptime monitoring](https://betterstack.com/uptime) [Status page Communicate downtime & build trust](https://betterstack.com/status-page) [Tracing eBPF-based OpenTelemetry-native tracing](https://betterstack.com/tracing) [Log management Collect insights across your stack](https://betterstack.com/log-management) [Infrastructure monitoring OpenTelemetry-native infrastructure monitoring](https://betterstack.com/infrastructure-monitoring) [Real user monitoring Session replay, web vitals & product analytics](https://betterstack.com/real-user-monitoring) [Error tracking AI‑native error tracking built on Better Stack](https://betterstack.com/error-tracking) [Data warehouse Time series data warehouse as an API](https://betterstack.com/warehouse) Back [Community home](https://betterstack.com/community) [Guides](https://betterstack.com/community/guides) [Questions](https://betterstack.com/community/questions) [Comparisons](https://betterstack.com/community/comparisons) Back [Work at Better Stack](https://betterstack.com/careers) [Engineering](https://betterstack.com/careers/engineering) [Security](https://betterstack.com/security) [Blog](https://betterstack.com/community/blog) [Changelog](https://betterstack.com/tag/changelog) Questions [Community](https://betterstack.com/community/?utm_content&utm_medium=questions&utm_source=community&utm_term=what-are-metaclasses-in-python) [Guides](https://betterstack.com/community/guides/?utm_content&utm_medium=questions&utm_source=community&utm_term=what-are-metaclasses-in-python) [Questions](https://betterstack.com/community/questions/?utm_content&utm_medium=questions&utm_source=community&utm_term=what-are-metaclasses-in-python) [Comparisons](https://betterstack.com/community/comparisons/?utm_content&utm_medium=questions&utm_source=community&utm_term=what-are-metaclasses-in-python) [Blog](https://betterstack.com/community/blog/?utm_content&utm_medium=questions&utm_source=community&utm_term=what-are-metaclasses-in-python) - [Community](https://betterstack.com/community/?utm_content&utm_medium=questions&utm_source=community&utm_term=what-are-metaclasses-in-python) - [Guides](https://betterstack.com/community/guides/?utm_content&utm_medium=questions&utm_source=community&utm_term=what-are-metaclasses-in-python) - [Questions](https://betterstack.com/community/questions/?utm_content&utm_medium=questions&utm_source=community&utm_term=what-are-metaclasses-in-python) - [Comparisons](https://betterstack.com/community/comparisons/?utm_content&utm_medium=questions&utm_source=community&utm_term=what-are-metaclasses-in-python) - [Blog](https://betterstack.com/community/blog/?utm_content&utm_medium=questions&utm_source=community&utm_term=what-are-metaclasses-in-python) [Docs](https://betterstack.com/docs/) [Documentation](https://betterstack.com/docs/) # What are metaclasses in Python? Better Stack Team Updated on January 24, 2023 In Python, a metaclass is the class of a class. It defines how a class behaves, including how it is created and how it manages its instances. A metaclass is defined by inheriting from the built-in `type` class, and it can define methods that customize the behavior of the class it creates. The class that a metaclass creates is called its "metaclass instance" or simply its "instance." One use of metaclasses is to create singleton classes, classes with only one instance. Here's an example of a simple metaclass that creates a singleton class: Copied\! ``` class Singleton(type): _instances = {} def __call__(cls, *args, **kwargs): if cls not in cls._instances: cls._instances[cls] = super().__call__(*args, **kwargs) return cls._instances[cls] class MySingletonClass(metaclass=Singleton): pass a = MySingletonClass() b = MySingletonClass() print(a is b) # True ``` Here, the `Singleton` metaclass defines a `__call__` method that intercepts the creation of new instances of the class it creates. It keeps track of instances it has created in the `_instances` dictionary, and if an instance of the class already exists, it returns that instance instead of creating a new one. So, every time you create an instance of `MySingletonClass`, you get the same object. This example is just a simple illustration of what metaclasses can do, and in most cases, this type of requirement could also be achieved by using other design patterns or python inbuilt modules like `Singleton from module` singleton-decorator\` . Got an article suggestion? [Let us know](mailto:hello@betterstack.com?subject=Suggestion%20for%20What%20are%20metaclasses%20in%20Python%3F&body=) Explore more [How to use the ternary conditional operator in Python? ![]() Questions](https://betterstack.com/community/questions/how-to-use-ternary-operator-in-python/) [What Does the “yield” Keyword Do in Python? ![]() Questions](https://betterstack.com/community/questions/what-does-yield-keyword-do-python/) [What Does if name == “main”: Do in Python? ![]() Questions](https://betterstack.com/community/questions/what-does-if-name-is-main-do-in-python/) [![Licensed under CC-BY-NC-SA]()](https://creativecommons.org/licenses/by-nc-sa/4.0/) This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. - [How to use the ternary conditional operator in Python? The ternary conditional operator is a shortcut when writing simple conditional statements. If the condition is short and both true and false branches are short too, there is no need to use a multi-... ![]() Questions](https://betterstack.com/community/questions/how-to-use-ternary-operator-in-python/) - [What Does the “yield” Keyword Do in Python? To better understand what yield does, you need first to understand what generator and iterable are. What is iterable When you use a list or list-like structure, you can read the values from the lis... ![]() Questions](https://betterstack.com/community/questions/what-does-yield-keyword-do-python/) - [What Does if name == “main”: Do in Python? The if \_\_name\_\_ == "main" is a guarding block that is used to contain the code that should only run went the file in which this block is defined is run as a script. What it means is that if you run... ![]() Questions](https://betterstack.com/community/questions/what-does-if-name-is-main-do-in-python/) Solutions [AI SRE](https://betterstack.com/ai-sre) [OpenTelemetry tracing](https://betterstack.com/tracing) [Log management](https://betterstack.com/telemetry) [Infrastructure monitoring](https://betterstack.com/infrastructure-monitoring) [Error tracking](https://betterstack.com/error-tracking) [Real user monitoring](https://betterstack.com/real-user-monitoring) [Incident management](https://betterstack.com/incident-management) [Uptime monitoring](https://betterstack.com/uptime) [Status page](https://betterstack.com/status-page) [Data warehouse](https://betterstack.com/warehouse) Company [Work at Better Stack](https://betterstack.com/careers) [Engineering](https://betterstack.com/careers/engineering) [Security](https://betterstack.com/security) Resources [Help & Support](https://betterstack.com/help) [Documentation](https://betterstack.com/docs/) [Enterprise](https://betterstack.com/enterprise) [Integrations](https://betterstack.com/integrations) [Dashboards](https://betterstack.com/dashboards) Company [Work at Better Stack](https://betterstack.com/careers) [Engineering](https://betterstack.com/careers/engineering) [Security](https://betterstack.com/security) Resources [Help & Support](https://betterstack.com/help) [Documentation](https://betterstack.com/docs/) [Enterprise](https://betterstack.com/enterprise) [Integrations](https://betterstack.com/integrations) [Dashboards](https://betterstack.com/dashboards) Community [What Is Incident Management? Beginner’s Guide](https://betterstack.com/community/guides/incident-management/what-is-incident-management/) [Best Datadog Alternatives to Consider in 2026](https://betterstack.com/community/comparisons/datadog-log-management-alternatives/) [8 Best Free & Open Source Status Page Tools in 2026](https://betterstack.com/community/comparisons/free-status-page-tools/) [13 Best Sentry Alternatives in 2026](https://betterstack.com/community/comparisons/sentry-alternatives/) [15 Best Grafana Alternatives in 2026](https://betterstack.com/community/comparisons/grafana-alternatives/) [The 10 Best Incident.io Alternatives in 2026](https://betterstack.com/community/comparisons/incident-io-alternative/) [5 Most Used Incident Management Tools](https://betterstack.com/community/comparisons/incident-management-tools/) 30x cheaper than Datadog. Predictable pricing. Exceptional customer support. [\+1 (628) 900-3830](<tel:+1 (628) 900-3830>) [hello@betterstack.com](mailto:hello@betterstack.com) [Terms of Use](https://betterstack.com/terms) [Privacy Policy](https://betterstack.com/privacy) [GDPR](https://betterstack.com/dpa) [System status](https://status.betterstack.com/) © 2026 Better Stack, Inc. ### Please accept cookies We use cookies to authenticate users, improve the product user experience, and for [personalized ads](https://business.safety.google/privacy/). [Learn more.](https://betterstack.com/privacy) Deny Accept required Accept all
Readable Markdown
Better Stack Team Updated on January 24, 2023 In Python, a metaclass is the class of a class. It defines how a class behaves, including how it is created and how it manages its instances. A metaclass is defined by inheriting from the built-in `type` class, and it can define methods that customize the behavior of the class it creates. The class that a metaclass creates is called its "metaclass instance" or simply its "instance." One use of metaclasses is to create singleton classes, classes with only one instance. Here's an example of a simple metaclass that creates a singleton class: Copied\! Here, the `Singleton` metaclass defines a `__call__` method that intercepts the creation of new instances of the class it creates. It keeps track of instances it has created in the `_instances` dictionary, and if an instance of the class already exists, it returns that instance instead of creating a new one. So, every time you create an instance of `MySingletonClass`, you get the same object. This example is just a simple illustration of what metaclasses can do, and in most cases, this type of requirement could also be achieved by using other design patterns or python inbuilt modules like `Singleton from module` singleton-decorator\` . Got an article suggestion? [Let us know](mailto:hello@betterstack.com?subject=Suggestion%20for%20What%20are%20metaclasses%20in%20Python%3F&body=) Explore more [![Licensed under CC-BY-NC-SA](https://betterstack.com/assets/articles/cc-by-nc-sa-198c1f75.png)](https://creativecommons.org/licenses/by-nc-sa/4.0/) This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Shard1 (laksa)
Root Hash1143718778839325401
Unparsed URLcom,betterstack!/community/questions/what-are-metaclasses-in-python/ s443