Bug?
Closed this issue · 4 comments
0x0a11c0de commented
Line 116 in 0f8da5f
Shouldn’t this be assigning datasets[key].name
?
Freaky commented
Yes, good catch. Luckily this is a dead store - nothing happens to read it afterwards.
adriaandegroot commented
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)
Freaky commented
Or just make one at the top of the function and share it across all calls.
Freaky commented
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()]