Closed ericvsmith closed 6 years ago
+1
(I expect someone will find a use for __dataclass_fields__
, but I really don't mind if they have to type the full name. :-)
Note that the module-level fields(obj)
just returns obj.__dataclass_fields__
and changes AttributeError
to ValueError
, if it's raised. So hopefully no one would need to look at __dataclass_fields__
, but people do funny things!
I agree with @ilevkivskyi that we should use a shorter name, and leverage the fact that this is a stdlib object to lay claim to
__post_init__
. The longer name is annoying because users of the class have to implement a function with this name.But I'd like to leave
__dataclass_fields__
, since that's truly an implementation detail and should never be used outside of dataclasses.py.