MCPcopy Index your code
hub / github.com/ipython/ipython / __add__

Method __add__

IPython/utils/ipstruct.py:164–177  ·  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

162 return self
163
164 def __add__(self,other):
165 """s + s2 -> New Struct made from s.merge(s2).
166
167 Examples
168 --------
169 >>> s1 = Struct(a=10,b=30)
170 >>> s2 = Struct(a=20,c=40)
171 >>> s = s1 + s2
172 >>> sorted(s.keys())
173 ['a', 'b', 'c']
174 """
175 sout = self.copy()
176 sout.merge(other)
177 return sout
178
179 def __sub__(self,other):
180 """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