On Friday, September 27, 2019, 07:47:41 AM PDT, Johnny Dahlberg <svartchimpans@gmail.com> wrote:

> My proposal: Implement `@dataclass(slots=True)` which does the same thing as attrs: Replaces the class with a modified class that has a `__slots__` property instead of a `__dict__`. And fully supporting default values in the process.

I don't think anyone would be against this in principle; the question is implementing it, and bikeshedding. For example, if nobody's come up with a better implementation than Eric's original one, should we add a @dataclass_slots decorator, or a @slotsify that you put around @dataclass, or get rid of the guarantee that @dataclass returns your class with extra dunders.

IIRC, the consensus after the discussion at the time was that this was a feature that could be added later, after a bit more experience in the field (and maybe someone will come up with a better implementation by then), so it was just deferred to the future rather than rejected.

Meanwhile, the @slotsify or @dataclass_slots should be writable as a PyPI package. Has anyone done that? If there's a popular and stable implementation, that's a good argument for merging it into the stdlib (and leaving it on PyPI as a backport). If it turned out to be tricky to implement without modifying dataclass itself, explaining why could also be a good argument for moving it into the stdlib.