class MyObject(): def __init__(self): self.a = 1 self.b = 2 self.c = 3 def __iter__(self): yield 'a', self.a yield 'b', self.b yield 'c', self.c dict(MyObject()) >>> { 'a': 1, 'b': 2, 'c': 3 }