On Friday, September 27, 2019, 07:47:41 AM PDT, Johnny Dahlberg <svartchimp...@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.
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/OQGEYZDD4X642ESWBW6YJCXQ2YUIEHCC/ Code of Conduct: http://python.org/psf/codeofconduct/