Re: Second post: PEP 557, Data Classes
From: | "Eric V. Smith" <eric-AT-trueblade.com> | |
To: | guido-AT-python.org | |
Subject: | Re: Second post: PEP 557, Data Classes | |
Date: | Wed, 29 Nov 2017 03:35:07 -0500 | |
Message-ID: | <b9d46d61-3896-9cbe-fc0a-5f4d808ca604@trueblade.com> | |
Cc: | Nick Coghlan <ncoghlan-AT-gmail.com>, "python-dev-AT-python.org" <python-dev-AT-python.org> |
On 11/28/2017 8:31 PM, Eric V. Smith wrote: > On 11/28/2017 4:14 PM, Guido van Rossum wrote: >> Hm. Maybe for the ordering comparisons we could defer to the class >> with the longest list of fields, as long as there's a subtype >> relationship? That way b<c and c>b would be equivalent, and both would >> use C.__gt__. Which had better not reject this on the basis that other >> is not an instance of a subclass of C. >> >> IIRC there's already something in the interpreter that tries the most >> derived class first for binary operators -- that may force our hand here. > > I'm leaning toward doing the same thing attrs does. They have much more > experience with this. Except that given Hynek's response in https://github.com/ericvsmith/dataclasses/issues/51#issue..., I'm just going to leave it as-is, with a strict type requirement for all 6 methods. Eric.