On Feb 5, 2010, at 2:08 PM, Paul McNett wrote:
> + def hasPK(self, pk):
> + """Return True if the passed pk is present in the dataset."""
> + pks = (v[self.KeyField] for v in self._records)
> + for trial_pk in pks:
> + if trial_pk == pk:
> + return True
> + return False
This should be faster:
def hasPK(self, pk):
"""Return True if the passed pk is present in the dataset."""
kf = self.self.KeyField
pks = [v[kf] for v in self._records
if v[kf] == pk]
return bool(pks)
-- Ed Leafe
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message:
http://leafe.com/archives/byMID/[email protected]