[issue39442] from __future__ import annotations makes dataclasses.Field.type a string, not type

Eric V. Smith report at bugs.python.org
Fri Jan 24 14:27:13 EST 2020


Eric V. Smith <eric at trueblade.com> added the comment:

> Should `dataclass.Field.type` become a property that evaluates the annotation at runtime much in the same way that `get_type_hints` works?

I think not. But maybe a function that evaluates all of the field types. Or maybe an @dataclass parameter to cause it to happen at definition time.

At this point, this seems more like fodder for python-ideas.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39442>
_______________________________________


More information about the Python-bugs-list mailing list