Note: This content was generated by AI. I am working on this page to provide personal content of better quality.

Flyweight

Nota bene : This content was generated by AI. I am working on this page to provide personal content of better quality.

Share intrinsic state among many similar objects to save memory.

Intent

Split intrinsic (shared) and extrinsic (context) state.

Python example

Chargement…

Console output

3 1 True

When to use

Thousands of objects share few immutable data variants.