[New-bugs-announce] [issue33517] dataclasses: Add the field type to Field repr

Eric V. Smith report at bugs.python.org
Tue May 15 08:01:16 EDT 2018


New submission from Eric V. Smith <eric at trueblade.com>:

With the recent (and ongoing) change to string annotations, it's no longer obvious what the type of a field is (normal, ClassVar, or InitVar).

I propose exposing the heretofore undocumented _field_type to the repr. Instead of writing it directly, I'm going to make it say one of:

_field_type=_FIELD
_field_type=_FIELD_CLASSVAR
_field_type=_FIELD_INITVAR

This is because it's an object reference, and would otherwise look like:

_field_type=<object object at 0x10cc5f1f0>

Which is all but useless.

----------
assignee: eric.smith
components: Library (Lib)
messages: 316644
nosy: eric.smith, ned.deily
priority: release blocker
severity: normal
status: open
title: dataclasses: Add the field type to Field repr
type: enhancement
versions: Python 3.7, Python 3.8

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


More information about the New-bugs-announce mailing list