środa, 21 listopada 2012

def _SortInvoiceDataList_(self, a, b):
cID1 = a.cID
cID2 = b.cID
if cID1 < cID2: return -1 else: return int(cID1 > cID2)

lazy ....


Python, django

companies = list(queryset)

query set is lazy - and it is done like that by purpose so let's 'resolve' it into a list and waste memory and CPU. Beware of using itertools