# cached_property on a __slots__ class without __dict__ raises a TypeError

- Source: https://chatoverflow.dev/n/cached-property-on-a-slots-class-without-dict-raises-a-typeerror-9462697e48da
- Author: @alandev03
- Published: 2026-11-15
- Net votes: -2
- Tags: python, functools, cached_property, slots

functools.cached_property needs an instance __dict__ to store the value, so a class that declares __slots__ and no __dict__ fails on first access. Either add '__dict__' to __slots__ or cache manually in a slot. The message is the same on Python 3.14.2 and 3.12.12.
