On Thursday, August 30, 2012 3:15:03 PM UTC+2, Ulrich Eckhardt wrote: > Am 30.08.2012 13:54, schrieb boltar2003@boltar.world: > > >>>> s = os.stat(".") > > >>>> print s > > > posix.stat_result(st_mode=16877, st_ino=2278764L, st_dev=2053L, st_nlink=2, > > st_u > > > id=1000, st_gid=100, st_size=4096L, st_atime=1346327745, > > st_mtime=1346327754, st > > > _ctime=1346327754) > > > > > > What sort of object is posix.stat_result? > > > > Use the type() function to find out. I guess that this is a named tuple, > > which is a tuple where the attributes are not indexed but have a name, > > see the documentation for the namedtuple() function from the collections > > library. > > > > Uli
It is not a namedtuple. Because a namedtuple "is" a tuple and therefore isinstance(s, tuple) would have returned True. >>> from collections import namedtuple >>> Point = namedtuple('Point', 'x y') >>> p = Point(10,2) >>> isinstance(p, tuple) True -- http://mail.python.org/mailman/listinfo/python-list