[Python-Dev] Concerns about method overriding and subclassing with dataclasses (original) (raw)

Guido van Rossum guido at python.org
Fri Dec 29 20:13:06 EST 2017


No, I am concerned about the rule being too complex to explain, and about surprising effects when the base changes (action at a distance).

I also don't necessarily think "we all agree" that what attrs does is wrong, but the rule I propose seems reasonable.

On Dec 29, 2017 5:58 PM, "Ethan Smith" <ethan at ethanhs.me> wrote:

On Fri, Dec 29, 2017 at 4:52 PM, Guido van Rossum <guido at python.org> wrote: I still think it should overrides anything that's just inherited but nothing that's defined in the class being decorated.

Could you explain why you are of this opinion? Is it a concern about complexity of implementation? On Dec 29, 2017 5:43 PM, "Nathaniel Smith" <njs at pobox.com> wrote: On Fri, Dec 29, 2017 at 12:30 PM, Ethan Furman <ethan at stoneleaf.us> 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.

What does attrs do here? -n -- Nathaniel J. Smith -- https://vorpus.org


Python-Dev mailing list Python-Dev at python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailma n/options/python-dev/guido%40python.org


Python-Dev mailing list Python-Dev at python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/ethan% 40ethanhs.me -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20171229/ff048447/attachment.html>



More information about the Python-Dev mailing list