This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Ricyteach
Recipients Ricyteach, eric.smith
Date 2018-03-26.13:49:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
In-reply-to <>
hmmm... if I check the C.d class attribute it seems to return the
descriptor instance object (not a field object) before any C instances have
been created. i guess this is just a part of how the dataclass
implementation works.

i didn't realize there's nothing "special" going on with descriptors here-
the descriptors "just work" by virtue of being set to the class attribute
at creation time. interesting.

maybe because of this descriptors should short-circuit the field creation
process entirely? that would be a shame though. having the option of
auto-including a descriptor in the class repr turns out to be very useful
and i'm already playing around with it in a project.

one idea: what if it there were a keyword argument to mark a field as a
descriptor, allowing tje descriptor to be set at type creation? this would
need to disallow init=True, i think. and setting a field default to a
descriptor class would then raise a type error.


"I've never met a Kentucky man who wasn't either thinking about going home
or actually going home." - Happy Chandler

On Mon, Mar 26, 2018 at 6:47 AM, Eric V. Smith <>

> Eric V. Smith <> added the comment:
> I suppose I could, when overwriting the class member, check for
> inspect.ismethoddescriptor and call __set_name__ myself.
> ----------
> components: +Library (Lib)
> versions: +Python 3.8
> _______________________________________
> Python tracker <>
> <>
> _______________________________________
Date User Action Args
2018-03-26 13:49:01Ricyteachsetrecipients: + Ricyteach, eric.smith
2018-03-26 13:49:01Ricyteachlinkissue33141 messages
2018-03-26 13:49:01Ricyteachcreate