jimsalterjrs/ioztat

Bug?

Closed this issue · 4 comments

ioztat/ioztat

Line 116 in 0f8da5f

d.name = datasets[key]

Shouldn’t this be assigning datasets[key].name?

Yes, good catch. Luckily this is a dead store - nothing happens to read it afterwards.

Perhaps L117 could be diff.append(DatasetDiff(Dataset(), datasets[key])) instead? The whole purpose of d there is to be an empty dataset, for comparison purposes, so why does it need a name at all?

(That said, I don't have enough of a handle on corner-cases of Python semantics to know how temporiaries behave in a calling context)

Or just make one at the top of the function and share it across all calls.

For consideration:

def calcDiff(prevdatasets, datasets):
    return [DatasetDiff(prevdatasets[key], datasets[key]) for key in datasets.keys() & prevdatasets.keys()]

def calcDiffFromStart(datasets):
    zero = Dataset()
    return [DatasetDiff(zero, dataset) for dataset in datasets.values()]