0

I'm following this tutorial on FUSE.

[FUSE tutorial][1]

And following is the documentation of FUSE

FUSE documentation

This might be more python related problem but I am unable to figure out. This is the method in the tutorial

def getattr(self, path, fh=None):
        print "getattr"
        full_path = self._full_path(path)
        # print full_path
        st = os.lstat(full_path)
        print key
        return dict((key, getattr(st, key)) for key in ('st_atime', 'st_ctime',
                     'st_gid', 'st_mode', 'st_mtime', 'st_nlink', 'st_size', 'st_uid'))

I understand the purpose of this method and it is working fine. But I'm unable to comprehend where this key is coming from. Tried printing it but it gave an error (as expected).

pink puffles
  • 43
  • 1
  • 8
  • 1
    Possible duplicate of [How exactly does a generator comprehension work?](https://stackoverflow.com/questions/364802/how-exactly-does-a-generator-comprehension-work) – Aran-Fey Mar 21 '18 at 11:54
  • @Aran-Fey So, key is generated on the fly? What could be it's possible values? – pink puffles Mar 21 '18 at 11:57
  • 1
    `key` iterates over the values in `('st_atime', 'st_ctime', 'st_gid', 'st_mode', 'st_mtime', 'st_nlink', 'st_size', 'st_uid')`. The 2nd answer in that question has some nice links to the documentation that are worth checking out. – Aran-Fey Mar 21 '18 at 12:01

0 Answers0