def setxattr(self, path, name, value, options, position=0):
# Ignore options
attrs = self.files[path].setdefault('attrs', {})
attrs[name] = value
The side-effect is achieved by setdefault
, which creates a new item in self.files[path]
(unless attrs
already exists as a key in it), and returns a reference to the value.
Next, that reference is modified, by assigning to its key name
, the value value
. By that operation too, self.files
is modified.