Eric V. Smith <[email protected]> added the comment:
Note that those strings are not docstrings, per se. They're just strings, and
aren't available in the class definition for the dataclass decorator to see.
It's really no different from:
class X:
x: int
3
That 3 just gets evaluated and thrown away, like the strings in your example.
To change this is beyond the scope of dataclasses, and would need to be a
language change. I can't think of a good way to attach the string to the
annotation before it (I'm assuming this would only work with annotations, but
maybe you have other ideas). You might want to bring this up on python-ideas to
get some more feedback.
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue38401>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com