def add(self, obj): if self.closed: raise eimaginary.Closed(self, obj) containedWeight = self.getContents().getColumn("weight").sum() if containedWeight + obj.weight > self.capacity: raise eimaginary.DoesntFit(self, obj) assert self.thing is not None obj.location = self.thing
def remove(self, obj): if self.closed: raise eimaginary.Closed(self, obj) if obj.location is self.thing: obj.location = None