[Python-Dev] PEP 557 Data Classes 5th posting (original) (raw)
Eric V. Smith eric at trueblade.com
Mon Dec 4 03:58:02 EST 2017
- Previous message (by thread): [Python-Dev] PEP 557 Data Classes 5th posting
- Next message (by thread): [Python-Dev] PEP 557 Data Classes 5th posting
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 12/3/2017 9:07 PM, Eric V. Smith wrote:
On 12/3/2017 8:31 PM, Guido van Rossum wrote:
On Sun, Dec 3, 2017 at 1:28 PM, Eric V. Smith <eric at trueblade.com_ _<mailto:eric at trueblade.com>> wrote:
On 12/3/2017 3:33 PM, Antoine Pitrou wrote:
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 asdict and astuple, 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. It also matchesattrs.asdict()
, which is what originally inspired it.
After a brief discussion at https://github.com/ericvsmith/dataclasses/issues/110, the decision is to leave the function names as-is, without underscores, to be consistent with namedtuples and attrs.
I'll add a note in the PEP's discussion section.
Eric.
- Previous message (by thread): [Python-Dev] PEP 557 Data Classes 5th posting
- Next message (by thread): [Python-Dev] PEP 557 Data Classes 5th posting
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]