Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(1)  |  Call(1)  |  Derive(0)  |  Import(0)
D.setdefault(k, d) -> D.get(k, d), also set D[k]=d if k not in D.

Return the value like get() except that if key is missing, d is both
returned and inserted into the BTree as the value of k.

src/r/e/repoze.whoplugins.zodb-1.0.1/repoze/who/plugins/zodb/users.py   repoze.whoplugins.zodb(Download)
                for group in groups:
                    group = self._convert(group)
                    groupset = self.groups.setdefault(group, set())
                    groupset.add(userid)
                    self.groups[group] = groupset