New submission from Raymond Hettinger <[email protected]>:
Formerly, the accessor for named tuples were more informative:
>>> class Pt(NamedTuple):
x: int
y: int
>>> vars(Pt)['x']
<property object at 0x10cc09a70>
>>> vars(Pt)['x'].fget
operator.itemgetter(0)
Currently, it is less informative:
>>> vars(Pt)['x']
<_collections._tuplegetter object at 0x1066a08e0>
The repr should be updated to show how the object could been created:
>>> vars(Pt)['x']
_tuplegetter(0, 'Alias for field number 0')
----------
assignee: rhettinger
components: Interpreter Core
keywords: easy (C)
messages: 366357
nosy: rhettinger
priority: normal
severity: normal
status: open
title: Improve repr for _tuplegetter objects
type: enhancement
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue40277>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com