Tagged articles
19 articles
Page 1 of 1
Python Programming Learning Circle
Python Programming Learning Circle
Nov 5, 2024 · Fundamentals

Implementing the Singleton Pattern in Python: Multiple Approaches and Thread Safety

This article explains the Singleton design pattern in Python, covering various implementation methods—including modules, decorators, classic classes, __new__ method, and metaclasses—while demonstrating thread‑safety concerns and solutions with locking, and provides complete code examples for each approach.

DecoratorMetaclassSingleton
0 likes · 10 min read
Implementing the Singleton Pattern in Python: Multiple Approaches and Thread Safety
Test Development Learning Exchange
Test Development Learning Exchange
Apr 13, 2024 · Fundamentals

Advanced Python Techniques: 10 In-Depth Code Examples

This article presents ten advanced Python techniques—including list comprehensions, lambda functions, decorators, context managers, generators, metaclasses, asyncio coroutines, enums, slicing, and exception handling—each illustrated with detailed code examples to help readers deepen their mastery of Python programming.

AdvancedDecoratorLambda
0 likes · 6 min read
Advanced Python Techniques: 10 In-Depth Code Examples
MaGe Linux Operations
MaGe Linux Operations
May 23, 2023 · Fundamentals

Mastering the Singleton Pattern in Python: Thread‑Safe Implementations

This article explains the purpose of the Singleton pattern, demonstrates multiple Python implementations—including module‑based, decorator, class‑based, __new__ method, and metaclass approaches—covers thread‑safety with locking, and provides complete code examples for each technique.

MetaclassSingletondesign pattern
0 likes · 10 min read
Mastering the Singleton Pattern in Python: Thread‑Safe Implementations
Python Programming Learning Circle
Python Programming Learning Circle
May 13, 2023 · Fundamentals

Implementing the Singleton Pattern in Python: Modules, Decorators, Classes, __new__ Method, and Metaclasses

This article explains the Singleton design pattern in Python, describing why a single instance may be needed, and demonstrates five implementation techniques—including module-level singletons, decorators, class methods, the __new__ method, and metaclasses—while addressing thread‑safety concerns with locking mechanisms.

MetaclassSingletondesign pattern
0 likes · 10 min read
Implementing the Singleton Pattern in Python: Modules, Decorators, Classes, __new__ Method, and Metaclasses
Python Programming Learning Circle
Python Programming Learning Circle
Aug 10, 2022 · Fundamentals

Implementing Thread‑Safe Singleton Pattern in Python

This article explains the purpose of the Singleton design pattern, demonstrates multiple Python implementations—including module‑level singletons, decorators, class‑based approaches, __new__ method, and metaclass techniques—and shows how to add thread‑safety with locks to ensure only one instance exists across concurrent executions.

DecoratorLockMetaclass
0 likes · 10 min read
Implementing Thread‑Safe Singleton Pattern in Python
FunTester
FunTester
Dec 1, 2021 · Backend Development

Hot Updating Java Apps with Groovy Metaclass and GroovyShell

This article demonstrates how to achieve Java hot‑update without rebuilding by leveraging Groovy's metaclass and GroovyShell, walking through a verification example, a full script implementation, and practical tips for handling script encoding issues.

Backend DevelopmentGroovyGroovyShell
0 likes · 5 min read
Hot Updating Java Apps with Groovy Metaclass and GroovyShell
FunTester
FunTester
Oct 28, 2021 · Backend Development

Adding Custom Methods to fastjson JSONObject Using Groovy MetaClass

This article demonstrates how to dynamically add custom methods to fastjson's JSONObject in Groovy by leveraging MetaClass and closures, providing code examples that simplify JSON traversal and output during API testing for developers.

DynamicMethodGroovyMetaclass
0 likes · 4 min read
Adding Custom Methods to fastjson JSONObject Using Groovy MetaClass
Qunar Tech Salon
Qunar Tech Salon
May 26, 2016 · Fundamentals

Understanding Python Metaclasses: Objects, Types, and Custom Class Creation

This article explains Python’s object model, showing that everything—including classes—is an object, describing how the built‑in type function serves as a metaclass, and demonstrating custom metaclass creation and practical examples such as subclass tracking and final class enforcement.

MetaclassObject-OrientedPython
0 likes · 6 min read
Understanding Python Metaclasses: Objects, Types, and Custom Class Creation