use a generator for __iter__ protocol