On 23 October 2012 01:43, Steven D'Aprano <st...@pearwood.info> wrote: > In general, your __iter__ method will be trivially simple: > > def __iter__(self): > return self > > and most of the logic will be in __next__. I see your __iter__ > method is a little more complicated, but I haven't studied it > in detail to see if the extra complication is justified.
The __iter__ method performs the same operation that is already performed in __init__ and __next__ so it is redundant. Probably it should reset the counter to restart iteration. However, in the provided code it is never called since the Env instance is never used in a for loop or iter() call. Oscar _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor