Tag

Class Attributes

1 views collected around this technical thread.

Test Development Learning Exchange
Test Development Learning Exchange
Mar 6, 2025 · Fundamentals

Understanding Class Attributes in Object‑Oriented Programming with Examples

This article explains the concept of class attributes in object‑oriented programming, contrasts them with instance attributes, and demonstrates ten practical scenarios—including shared data, default values, instance counting, singleton and factory patterns—through clear Python code examples and usage guidelines.

Class AttributesFactoryPython
0 likes · 10 min read
Understanding Class Attributes in Object‑Oriented Programming with Examples
Rare Earth Juejin Tech Community
Rare Earth Juejin Tech Community
Jul 1, 2024 · Backend Development

Resolving Data Contamination in Multithreaded Security Testing by Redesigning Class Attributes in Python

This article explains how using a shared class attribute to store open ports in a Python security‑testing framework can cause data contamination across threads, demonstrates the problem with example code, and presents three solutions—reinitializing the attribute, using contextvars, and employing threading.local—to ensure thread‑local isolation and accurate port scanning.

Class AttributesContextVarMultithreading
0 likes · 10 min read
Resolving Data Contamination in Multithreaded Security Testing by Redesigning Class Attributes in Python
Python Programming Learning Circle
Python Programming Learning Circle
Jan 10, 2020 · Fundamentals

Understanding Python Class and Instance Attribute Lookup Rules

This article explains Python’s dynamic attribute lookup mechanism, detailing how class and instance scopes differ, how attributes are searched and assigned, and demonstrates these concepts with concrete code examples that illustrate the impact on class versus instance state.

Attribute LookupClass AttributesDynamic Language
0 likes · 5 min read
Understanding Python Class and Instance Attribute Lookup Rules