1 repositorio
Stores instance attributes in a compact C-level array instead of a dictionary, reducing memory overhead.
Distinct from Memory Layout Optimizations: Distinct from Memory Layout Optimizations: specifically uses Python slots for instance attribute storage, not general data structure layout.
Explore 1 awesome GitHub repository matching software engineering & architecture · Slot-Based Instance Layouts. Refine with filters or upvote what's useful.
attrs is a Python library that automatically generates initialization, representation, equality, hashing, and ordering methods from declarative class attribute definitions. At its core, it provides a class decorator metaprogramming framework that intercepts class creation to rewrite the class body, producing dunder methods without manual boilerplate. The library includes a comprehensive attribute validation toolkit with built-in validators for type checks, range constraints, regex matching, length limits, and logical composition of validation rules. The library distinguishes itself through it
Stores instance attributes in slots instead of dictionaries, reducing memory overhead and improving access speed.