simvx.core.graphics._slots

The attribute names a __slots__ class stores, for the copy protocols.

class:

~simvx.core.graphics.texture.Texture and

class:

~simvx.core.graphics.material.Material both hand-roll __copy__, __deepcopy__ and the pickle pair, and both need the same list. One helper, so a correction lands in one place.

Module Contents

Functions

slot_names

Every attribute name cls stores in a slot, base classes included.

Data

API

simvx.core.graphics._slots.__all__

[‘slot_names’]

simvx.core.graphics._slots.slot_names(cls: type) tuple[str, ...][source]

Every attribute name cls stores in a slot, base classes included.

The whole MRO is walked rather than one class’s __slots__, so a subclass that adds slots of its own keeps them: backends subclass to add GPU state. Names are returned most-derived first and each appears once.

Two spellings that a naive read of __slots__ gets wrong are handled here. __slots__ = "x" is a legal single-name form that iterates as characters, and a private name is mangled by the class body that declared it, so __slots__ = ("__x",) in Foo creates a slot called _Foo__x.