Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

make class iterable

How do I make a class iterable?

I want to create a class, which is a set of objects that I created, that has attributes of its own.

The user experience I am thinking of is the following:

(let's say A, B, and C are Objects in memory)

sage: D = Box((A,B,C))

I want to be able to say for i in D: ....

But I can't.

Any tips?