tuple as dictionary key
Hello!
Code inspector doesn't like when i write (it's allowed in python, though):
for row in Salary.objects.all():
j, p, m = row.job_id, row.payment_id, row.movement_type
if (j,p,m) not in self.salaries:
self.salaries[j,p,m] = []
self.salaries[j,p,m].append((row.dt_start, row.dt_end, row.rate))
the following code marks append method as unrecognized
if i change it to
for row in Salary.objects.all():
j, p, m = row.job_id, row.payment_id, row.movement_type
if (j,p,m) not in self.salaries:
self.salaries[(j,p,m)] = []
self.salaries[(j,p,m)].append((row.dt_start, row.dt_end, row.rate))
i think that the first example is also valid, so it needs to be fixed
Please sign in to leave a comment.