New submission from Raymond Hettinger <raymond.hettin...@gmail.com>:

The current __repr__ for structseq only shows the name/value pairs for the 
positional part and it ignores the other named fields.

For example, os.stat(somefile) returns:
posix.stat_result(st_mode=33277, st_ino=8468407, st_dev=234881026, st_nlink=1, 
st_uid=0, st_gid=80, st_size=25424, st_atime=1301263901, st_mtime=1298229258, 
st_ctime=1298283922)

but it doesn't show the other named fields and their values:
{'st_ctime': 1298283922.0, 'st_rdev': 0, 'st_mtime': 1298229258.0, 'st_blocks': 
56, 'st_flags': 0, 'st_gen': 0, 'st_atime': 1301263901.0, 'st_blksize': 4096, 
'st_birthtime': 1298229258.0}

The __reduce__ method for structseq returns both the tuple portion and the 
dictionary portion.  The latter needs to be added to the repr so that 
information doesn't get hidden from the user.

----------
components: Interpreter Core
keywords: easy
messages: 132372
nosy: rhettinger
priority: low
severity: normal
status: open
title: Improve repr for structseq objects to show named, but unindexed fields
type: feature request
versions: Python 3.3

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue11698>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to