Closed
Description
Bug report
Bug description:
The first argument of the new __replace__
method on dataclasses is conspicuously named obj
rather than self
. While that's not a bug, it would be kinder on introspection tools to use self
, since it is otherwise a regular instance method.
>>> import dataclasses, inspect, pprint
>>> @dataclasses.dataclass
... class Foo:
... x: int
...
>>> pprint.pprint({n:inspect.signature(f) for n, f in inspect.getmembers(Foo, inspect.isfunction)})
{'__eq__': <Signature (self, other)>,
'__init__': <Signature (self, x: int) -> None>,
'__replace__': <Signature (obj, /, **changes)>,
'__repr__': <Signature (self)>}
__replace__
was added in #108752
CPython versions tested on:
3.13
Operating systems tested on:
macOS