On 8 October 2015 at 01:47, Steven D'Aprano <st...@pearwood.info> wrote: > In 3.3, you will have a problem that FrozenDict is not a proper > iterator. You can't set self.__next__ = self.next, that won't work. > Dunder methods have to be on the class, not on the instance, so instead > of making the assignment in the __init__ method, put this in the body of > your class: > > def next(self): > # Python 2 method > ... > > __next__ = next # Python 3 method. > > > Unfortunately that's not enough to get it working in Python 3. I need > more time to think about that.
There shouldn't be a __next__ method on the FrozenDict class. __iter__ should return a distinct iterator. Albert has already fixed this by using: def __iter__(self): return iter(self.__kwargs) -- Oscar _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor