Message132372
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. |
|
Date |
User |
Action |
Args |
2011-03-27 22:14:57 | rhettinger | set | recipients:
+ rhettinger |
2011-03-27 22:14:57 | rhettinger | set | messageid: <1301264097.04.0.982421975108.issue11698@psf.upfronthosting.co.za> |
2011-03-27 22:14:56 | rhettinger | link | issue11698 messages |
2011-03-27 22:14:56 | rhettinger | create | |
|