18 Mar
2022
18 Mar
'22
5:14 p.m.
On 3/18/2022 2:38 PM, Eric V. Smith wrote:
There a practical need for these changes. See https://bugs.python.org/issue46382 for a case where dataclasses needs __slots__ to be iterated over after the class has been created. And it would be good if __slots__ accurately reflected the slots that were actually created.
It seems totally sufficient for dataclasses to require that base class __slots__ are a string or iterables of strings. Which is apparently what would happen today, since anything else would cause incorrect behaviour. A single special case doesn't have to become a language-wide backwards compatibility break, even if it perhaps would've been better to have had the restriction from the start. Cheers, Steve