This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients rhettinger
Date 2011-03-27.22:14:56
SpamBayes Score 4.810129e-06
Marked as misclassified No
Message-id <1301264097.04.0.982421975108.issue11698@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2011-03-27 22:14:57rhettingersetrecipients: + rhettinger
2011-03-27 22:14:57rhettingersetmessageid: <1301264097.04.0.982421975108.issue11698@psf.upfronthosting.co.za>
2011-03-27 22:14:56rhettingerlinkissue11698 messages
2011-03-27 22:14:56rhettingercreate