[Python-Dev] PEP 557 Data Classes 5th posting

Guido van Rossum guido at python.org
Sun Dec 3 20:31:13 EST 2017


On Sun, Dec 3, 2017 at 1:28 PM, Eric V. Smith <eric at trueblade.com> wrote:

> On 12/3/2017 3:33 PM, Antoine Pitrou wrote:
>
>> On Sat, 2 Dec 2017 09:02:37 -0500
>> "Eric V. Smith" <eric at trueblade.com> wrote:
>>
>>> I've pushed another version of PEP 557. The only difference is changing
>>> the default value of "order" to False instead of True. This matches
>>> regular classes: instances can be tested for equality, but are unordered.
>>>
>>> Discussion at https://github.com/ericvsmith/dataclasses/issues/104
>>>
>>> It's already available at https://www.python.org/dev/peps/pep-0557/
>>>
>>
>> Thanks.  I have to ask: why don't "asdict" and "astuple" respect PEP 8
>> naming?
>>
>
> I guess it depends if you think the underscore is needed to improve
> readability. "Function names should be lowercase, with words separated by
> underscores as necessary to improve readability."
>
> I don't feel strongly enough about it to change it, but part of that is
> because I'm burned out on the PEP, so I might not be a good one to judge at
> this point. I guess if I clear my head and I were doing it from scratch
> again I'd make them as_dict and as_tuple, so maybe I should brush aside
> inertia and make the change.
>

The Python stdlib is incredibly inconsistent where it comes to inserting
underscores. I think in this case it matches `namedtuple._asdict()` and
that's good enough for me.

-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20171203/42535730/attachment.html>


More information about the Python-Dev mailing list