mirror of
https://github.com/python/cpython.git
synced 2025-10-02 05:12:23 +00:00
bpo-33494: Change dataclasses.Fields repr to use the repr of each of its members (GH-6798)
(cherry picked from commit 2473eea65d
)
Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
This commit is contained in:
parent
050e041bf7
commit
ceb45f0df8
2 changed files with 11 additions and 8 deletions
|
@ -230,14 +230,14 @@ class Field:
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return ('Field('
|
return ('Field('
|
||||||
f'name={self.name!r},'
|
f'name={self.name!r},'
|
||||||
f'type={self.type},'
|
f'type={self.type!r},'
|
||||||
f'default={self.default},'
|
f'default={self.default!r},'
|
||||||
f'default_factory={self.default_factory},'
|
f'default_factory={self.default_factory!r},'
|
||||||
f'init={self.init},'
|
f'init={self.init!r},'
|
||||||
f'repr={self.repr},'
|
f'repr={self.repr!r},'
|
||||||
f'hash={self.hash},'
|
f'hash={self.hash!r},'
|
||||||
f'compare={self.compare},'
|
f'compare={self.compare!r},'
|
||||||
f'metadata={self.metadata}'
|
f'metadata={self.metadata!r}'
|
||||||
')')
|
')')
|
||||||
|
|
||||||
# This is used to support the PEP 487 __set_name__ protocol in the
|
# This is used to support the PEP 487 __set_name__ protocol in the
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
Change dataclasses.Fields repr to use the repr of each of its members,
|
||||||
|
instead of str. This makes it more clear what each field actually
|
||||||
|
represents. This is especially true for the 'type' member.
|
Loading…
Add table
Add a link
Reference in a new issue