Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Closed
Description
Bug report
Bug description:
The first argument of the new__replace__ method on dataclasses is conspicuously namedobj rather thanself. While that's not a bug, it would be kinder on introspection tools to useself, since it is otherwise a regular instance method.
>>>importdataclasses,inspect,pprint>>>@dataclasses.dataclass...classFoo:...x:int...>>>pprint.pprint({n:inspect.signature(f)forn,fininspect.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