New submission from Arie Bovenberg <a.c.bovenb...@gmail.com>:
As discussed in bpo-46382, dataclasses may want to support the __weakref__ slot. Currently, automatically slotted dataclasses are not given a __weakref__ slot. This makes auto-slotted dataclasses incompatible with weakref. The attrs library has chosen for the following approeach: - when slots are generated, a __weakref__ slot is added by default - this may be optionally disabled with the weakref_slot=False flag See this discussion on why that approach was taken: https://github.com/python-attrs/attrs/pull/420 The question for dataclass is: do we want to follow suit? Or perhaps make __weakref__ slot opt-in instead of opt-out? ---------- components: Library (Lib) messages: 415515 nosy: ariebovenberg, eric.smith priority: normal severity: normal status: open title: Mechanism to enable __weakref__ slot on dataclass(slots=True) versions: Python 3.11 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue47059> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com