MCPcopy Create free account
hub / github.com/ipython/ipython / __add__

Method __add__

IPython/utils/ipstruct.py:168–182  ·  view source on GitHub ↗

s + s2 -> New Struct made from s.merge(s2). Examples -------- >>> s1 = Struct(a=10,b=30) >>> s2 = Struct(a=20,c=40) >>> s = s1 + s2 >>> sorted(s.keys()) ['a', 'b', 'c']

(self,other)

Source from the content-addressed store, hash-verified

166 return self
167
168 def __add__(self,other):
169 """s + s2 -> New Struct made from s.merge(s2).
170
171 Examples
172 --------
173
174 >>> s1 = Struct(a=10,b=30)
175 >>> s2 = Struct(a=20,c=40)
176 >>> s = s1 + s2
177 >>> sorted(s.keys())
178 ['a', 'b', 'c']
179 """
180 sout = self.copy()
181 sout.merge(other)
182 return sout
183
184 def __sub__(self,other):
185 """s1 - s2 -> remove keys in s2 from s1.

Callers

nothing calls this directly

Calls 2

copyMethod · 0.95
mergeMethod · 0.80

Tested by

no test coverage detected