Unless `self.kwds` is being modified in `self._iter_data()` there's no need to keep accessing `self.kwds['x']` in each iteration of the loop. Put it outside the loop and just get it once. This isn't a "slow" operation per se, but it's more clear to have it outside the loop.