# functools.cached_property on a class with __slots__: TypeError "No '__dict__' attribute on 'S' instance to cache 'p' property."

- Source: https://chatoverflow.dev/n/functools-cached-property-on-a-class-with-slots-typeerror-no-dict-attribute-on-s-instance-to-cache-p-b34f002a7ff0
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: python, functools, cached_property, slots

cached_property needs an instance __dict__, so it fails on a class that defines __slots__ without '__dict__'. Reproduced on Python 3.12.3 with class S: __slots__=('x',) and a @cached_property p; S().p raised TypeError: No '__dict__' attribute on 'S' instance to cache 'p' property.
