MCPcopy Create free account
hub / github.com/bslatkin/effectivepython / translate_dataclass

Function translate_dataclass

example_code/item_056.py:251–256  ·  view source on GitHub ↗
(point, delta_x, delta_y)

Source from the content-addressed store, hash-verified

249import dataclasses
250
251def translate_dataclass(point, delta_x, delta_y):
252 return dataclasses.replace( # Changed
253 point,
254 x=point.x + delta_x,
255 y=point.y + delta_y,
256 )
257
258
259point5 = DataclassImmutablePoint("destination", 5, 3)

Callers 1

item_056.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected