On Fri, Jan 5, 2018 at 5:08 AM, Eric V. Smith <e...@trueblade.com> wrote:

> On 1/2/2018 12:01 AM, Guido van Rossum wrote:
>
>> Yes, there's a class variable (__dataclass_fields__) that identifies the
>> parent fields. The PEP doesn't mention this or the fact that special
>> methods (like __repr__ and __init__) can tell whether a base class is a
>> dataclass. It probably should though. (@Eric)
>>
>
> I think that's covered in this section: https://www.python.org/dev/pep
> s/pep-0557/#inheritance
>

I was specifically talking about the name and contents of __dataclass_fields__,
which are not documented by the PEP. I expect it's inevitable that people
will be looking at this (since they can see it in the source code). Or do
you recommend that people use dataclasses.fields() and catch ValueError? I
notice that _isdataclass() exists but is private and I don't recall why.
(Also now I'm curious what the "pseudo-fields" are that fields() ignores,
but that's OT.)

-- 
--Guido van Rossum (python.org/~guido)
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to