[Python-Dev] Concerns about method overriding and subclassing with dataclasses (original) (raw)
Ethan Furman ethan at stoneleaf.us
Fri Dec 29 20:04:35 EST 2017
- Previous message (by thread): [Python-Dev] Concerns about method overriding and subclassing with dataclasses
- Next message (by thread): [Python-Dev] Concerns about method overriding and subclassing with dataclasses
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Fri, Dec 29, 2017 at 12:30 PM, Ethan Furman wrote:
Good point. So auto-generate a new repr if:
- one is not provided, and
- existing repr is either:
- object.repr, or
- a previous dataclass repr
And if the auto default doesn't work for one's use-case, use the keyword parameter to specify what you want.
On Dec 29, 2017 5:43 PM, "Nathaniel Smith" wrote:
What does attrs do here?
On 12/29/2017 04:52 PM, Ethan Smith wrote:
attrs just silently overwrites any user provided repr unless you provide repr=False to attr.s.
On 12/29/2017 04:52 PM, Guido van Rossum wrote:
I still think it should overrides anything that's just inherited but nothing that's defined in the class being decorated.
I can certainly live with that.
--
Ethan
- Previous message (by thread): [Python-Dev] Concerns about method overriding and subclassing with dataclasses
- Next message (by thread): [Python-Dev] Concerns about method overriding and subclassing with dataclasses
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]