This one looks like it might get messy: dataclasses and attrs differ on the ordering of inherited attribs. For class A: x: int y: str class B(A): x: bool z: int dataclasses will infer the combined init list (x: bool, y: str, z: int) and attrs will infer (y: str, x: bool, z: int) martin On Fri, May 7, 2021 at 12:58 PM Martin DeMello <mdemello@google.com> wrote:
Another corner case I just had to add to pytype - attrs supports `kw_only` annotations on individual fields. It seems worth adding that to the list of standard `field` parameters.
martin
On Thu, Apr 29, 2021 at 2:09 PM Eric Traut <eric@traut.com> wrote:
Thanks for the feedback, Martin.
That's a good point about `office_number` being interpreted as a class variable. My intent was to match the semantics of dataclass, and this was simply a bug in the spec. I've updated the spec accordingly.
As for `InitVar`, none of the other libraries that I've reviewed have a similar concept (at least that I've noticed), so I didn't see a need to add support for custom `InitVar` classes. If one of these libraries decides to add support in the future, I would encourage them to use `dataclass.InitVar` rather than creating a new class with the same semantics.
-Eric
-- Eric Traut Contributor to Pyright & Pylance Microsoft Corp. _______________________________________________ Typing-sig mailing list -- typing-sig@python.org To unsubscribe send an email to typing-sig-leave@python.org https://mail.python.org/mailman3/lists/typing-sig.python.org/ Member address: mdemello@google.com