|   | 1 |  initial version  | 
Your class must implement an __iter__ method:
class Foo(SageObject):
    def __iter__(self):
        for i in range(10):
            yield(i)
Then you can just say:
sage: bar = Foo()
sage: list(bar)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
 Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.
 
                
                Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.