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

Method __sub__

IPython/utils/ipstruct.py:184–198  ·  view source on GitHub ↗

s1 - s2 -> remove keys in s2 from s1. Examples -------- >>> s1 = Struct(a=10,b=30) >>> s2 = Struct(a=40) >>> s = s1 - s2 >>> s {'b': 30}

(self,other)

Source from the content-addressed store, hash-verified

182 return sout
183
184 def __sub__(self,other):
185 """s1 - s2 -> remove keys in s2 from s1.
186
187 Examples
188 --------
189
190 >>> s1 = Struct(a=10,b=30)
191 >>> s2 = Struct(a=40)
192 >>> s = s1 - s2
193 >>> s
194 {'b': 30}
195 """
196 sout = self.copy()
197 sout -= other
198 return sout
199
200 def __isub__(self,other):
201 """Inplace remove keys from self that are in other.

Callers

nothing calls this directly

Calls 1

copyMethod · 0.95

Tested by

no test coverage detected