MCPcopy Create free account
hub / github.com/numpy/numpy / __setattr__

Method __setattr__

numpy/core/records.py:267–279  ·  view source on GitHub ↗
(self, attr, val)

Source from the content-addressed store, hash-verified

265 "attribute '%s'" % attr)
266
267 def __setattr__(self, attr, val):
268 if attr in ('setfield', 'getfield', 'dtype'):
269 raise AttributeError("Cannot set '%s' attribute" % attr)
270 fielddict = nt.void.__getattribute__(self, 'dtype').fields
271 res = fielddict.get(attr, None)
272 if res:
273 return self.setfield(val, *res[:2])
274 else:
275 if getattr(self, attr, None):
276 return nt.void.__setattr__(self, attr, val)
277 else:
278 raise AttributeError("'record' object has no "
279 "attribute '%s'" % attr)
280
281 def __getitem__(self, indx):
282 obj = nt.void.__getitem__(self, indx)

Callers 1

__setattr__Method · 0.45

Calls 2

__getattribute__Method · 0.45
getMethod · 0.45

Tested by

no test coverage detected