I am having a hard time writing a class, which should be able to iterate through a sorted dicitonary. My main problem is at the iter-overload. I don\'t how to get the dic so
Since you're willing to sort at the point you begin the iteration, all you need is:
def __iter__(self): return iter(sorted(self.dic))
__iter__ has to return an iterator, and the builtin function iter() gets one from the sorted list of keys. Job done, no need for a next() function.
__iter__
iter()
next()