Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

After implementing @burcin's advice, and getting help from another friend, I found this to be a really good way to get set-like behavior from any SageObject:

class ActsLikeASetButIsntASet(SageObject):
    def __init__(self,_set):
        self.values = _set
        self.iterator = self.__iter__()
        if self.values != set():
    def __iter__(self):
        for this_entry in self.values:
            yield this_entry
    def get_set(self):
        return set(self.values)
    def __repr__(self):
        return str(list(self.values))
    def __getattr__(self,attr):
        return getattr(self.values,attr)