You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

normal_data.py 468 B

123456789101112131415161718
  1. class NormalIterator:
  2. def __init__(self, num_of_data=1000):
  3. self._num_of_data = num_of_data
  4. self._data = list(range(num_of_data))
  5. self._index = 0
  6. def __iter__(self):
  7. return self
  8. def __next__(self):
  9. if self._index >= self._num_of_data:
  10. raise StopIteration
  11. _data = self._data[self._index]
  12. self._index += 1
  13. return self._data
  14. def __len__(self):
  15. return self._num_of_data