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 serhiy.storchaka
Recipients Arfrever, berker.peksag, dlam, eric.araujo, eric.snow, ezio.melotti, lilydjwg, mblahay, pconnell, pitrou, rhettinger, serhiy.storchaka, sunfinite
Date 2020-10-19.08:47:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1603097252.93.0.637610286666.issue11698@roundup.psfhosted.org>
In-reply-to
Content
Other problem is that the repr looks like an evaluable expression, but evaluating it will always produce error.

>>> st = os.stat('/dev/null')
>>> st
os.stat_result(st_mode=8630, st_ino=6, st_dev=6, st_nlink=1, st_uid=0, st_gid=0, st_size=0, st_atime=1602523313, st_mtime=1602523313, st_ctime=1602523313)
>>> os.stat_result(st_mode=8630, st_ino=6, st_dev=6, st_nlink=1, st_uid=0, st_gid=0, st_size=0, st_atime=1602523313, st_mtime=1602523313, st_ctime=1602523313)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: structseq() takes at most 2 keyword arguments (10 given)

os.stat_result() accepts only two arguments: a tuple for indexable elements and a dict for non-indexable elements.

>>> os.stat_result((8630, 6, 6, 1, 0, 0, 0, 1602523313, 1602523313, 1602523313), {'st_atime': 1602523313.282834, 'st_mtime': 1602523313.282834, 'st_ctime': 1602523313.282834, 'st_atime_ns': 1602523313282834115, 'st_mtime_ns': 1602523313282834115, 'st_ctime_ns': 1602523313282834115, 'st_blksize': 4096, 'st_blocks': 0, 'st_rdev': 259})
os.stat_result(st_mode=8630, st_ino=6, st_dev=6, st_nlink=1, st_uid=0, st_gid=0, st_size=0, st_atime=1602523313, st_mtime=1602523313, st_ctime=1602523313)

But such form looks not very readable, because it lacks names for indexable elements.

To solve this we can use an angular form in the repr:

<os.stat_result ...>
History
Date User Action Args
2020-10-19 08:47:33serhiy.storchakasetrecipients: + serhiy.storchaka, rhettinger, pitrou, ezio.melotti, eric.araujo, Arfrever, eric.snow, lilydjwg, berker.peksag, dlam, pconnell, sunfinite, mblahay
2020-10-19 08:47:32serhiy.storchakasetmessageid: <1603097252.93.0.637610286666.issue11698@roundup.psfhosted.org>
2020-10-19 08:47:32serhiy.storchakalinkissue11698 messages
2020-10-19 08:47:32serhiy.storchakacreate