MCPcopy Create free account
hub / github.com/ActiveState/code / _replace

Method _replace

recipes/Python/500261_Named_Tuples/recipe-500261.py:140–141  ·  view source on GitHub ↗
(self, _map=map, **kwds)

Source from the content-addressed store, hash-verified

138 'Point class with optimized _make() and _replace() without error-checking'
139 _make = classmethod(tuple.__new__)
140 def _replace(self, _map=map, **kwds):
141 return self._make(_map(kwds.get, ('x', 'y'), self))
142
143 print Point(11, 22)._replace(x=100)
144

Callers 1

recipe-500261.pyFile · 0.45

Calls 2

_mapFunction · 0.85
_makeMethod · 0.80

Tested by

no test coverage detected