[Python-ideas] [dataclasses] add a NON_FIELDS sentinel after which all attributes are ignored.

2023-06-22 Thread Randolf Scholz
Dataclasses should provide a way to ignore a type hinted attributes, and not consider them as fields. For example, some attributes might be derived during `__post_init__` from the values of the fields or other variables. If one wants to still type hint these attributes, one has to awkward work

[Python-ideas] Re: [dataclasses] add a NON_FIELDS sentinel after which all attributes are ignored.

2023-06-22 Thread Christopher Barker
Hmm, It does make you wonder if using the presence of an annotation to indicate a field was a good choice -- but here we are. Additionally one could consider adding an `attribute` typing construct, > such that `attr0: attribute[int]` would mark it as a non-field attribute. > Better yet, a datacl

[Python-ideas] Re: [dataclasses] add a NON_FIELDS sentinel after which all attributes are ignored.

2023-06-22 Thread Jelle Zijlstra
El jue, 22 jun 2023 a las 8:22, Randolf Scholz () escribió: > Dataclasses should provide a way to ignore a type hinted attributes, and > not consider them as fields. > > For example, some attributes might be derived during `__post_init__` from > the values of the fields or other variables. > > If