The information returned by stat is not intuitive:
(33152, None, None, 1, u'1004', u'1004', 6, None, 1421830200.0, None)
I know where to get the relevant docs. But it would be much easier to deal with the result, if a namedtuple would be used.
I just gave it a try:
class StatResult(tuple): """ Support class resembling a tuple like that returned from `os.(l)stat`. """ ...
StatResultBase = collections.namedtuple( "StatResult", ["st_mode", "st_ino", "st_dev", "st_nlink", "st_uid", "st_gid", "st_size", "st_atime", "st_mtime", "st_ctime"]) class StatResult(StatResultBase): """ Support class resembling a tuple like that returned from `os.(l)stat`. """ ...
The problem is that before the
StatResultconstructor took one argument (the tuple with the items to use) and with the change the
StatResultconstructor takes 11 arguments (the tuple items).
StatResultis a public class for implementation of custom parsers, I don't want to change the
As you suggest, I also think the idea behind using a
namedtupleisn't the class itself, but the representation of its instances. Therefore I added a
StatResultso that the representation looks like that of a
__repr__so that a
StatResultlooks like a named tuple (#91) ...").