Hi Bruno,

On 4/8/24 12:30 PM, Bruno Haible wrote:
> Typically, when one changes a function, one should ask oneself
> "should the doc string be updated?"

Yes, I forget this sometimes...

> This is better. But wait: If a return value is a list with unspecified
> sorting order, and doesn't contain duplicates, then list is the wrong
> data type. The function should return a set then.

Makes sense.

> This patch goes into a right direction. But when the field contains a set,
> the accessors getAvoids and setAvoids should IMO also return a set and
> accept a set, respectively.

I don't think the GLModuleTable.getAvoids() is used. But it is
difficult to tell because we also have GLConfig.getAvoids(). And for
both of those we have these to access them:

     var = table['avoids']   # table is a GLModuleTable
     var = config['avoids']  # config is a GLConfig

So it is difficult to tell. I know we have this in GLConfig for the
cache handling, but I don't think it is important for GLModuleTable.
I'll look into that more.

> It does not make the line
> 
>             if str(parent) not in self.dependers[str(module)]:
> 
> redundant. self.dependers[str(module)] should not contain duplicates.

Ah, okay. Which makes me question whether sorting is important. I do
not believe so, but I have to double check. If we don't care about
sorting then a set would work in that case.

Collin

Reply via email to