I would like to define a single object that can be iterated over without having to create a class and then an instance. Something like this:
class Thing(object): stuff = ["foo", "bar", "baz"] @classmethod def __iter__(cls): return iter(cls.stuff) for thing in Thing: print thing However this doesn't actually work. Is there any way to do this?
__iter__on the metaclass.