def _create(self,parent = None): """ make lean and mean cause its called a ton """ self.inc() new = shallow_clone(self) new.set_parent(parent) #next 2 lines removed to higher level for speed #new._children = [] #if parent is None: new.symbol_table = {} return new
def clone(self): new = shallow_clone(self) if(self.root): new.root = self.root.clone() return new
def data_clone(self): new = shallow_clone(self) new.data = map(lambda x: x.clone(),self.data) return new
def __mul__(self, n): new = shallow_clone(self) new.data = self.data*n new.touch() return new
def __radd__(self, list): new = shallow_clone(self) if type(list) == type(self.data): new.data = list + self.data else: new.data = list.data + self.data new.touch() return new
def __getslice__(self, i, j): new = shallow_clone(self) new.data = self.data[i:j] new.touch() return new
def clone(self): """ Makes a shallow copy of the object. Override if you need more specialized behavior. """ return shallow_clone(self)
def clone(self): return shallow_clone(self) def __float__(self): return float(self._value)