ericvsmith / dataclasses

Apache License 2.0
587 stars 53 forks source link

Also generate namedtuples? #40

Closed ericvsmith closed 7 years ago

ericvsmith commented 7 years ago

It occurs to me that I could also use this mechanism to generate namedtuples. I'm not saying it should happen in this PEP, but it might be worth considering when deciding on names and APIs.

ericvsmith commented 7 years ago

In particular, the module-level APIs, which could apply to both data classes and the hypothetical namedtuples.

ilevkivskyi commented 7 years ago

TBH, I would keep typing.NamedTuple in typing. It is already extensively used and has special support in mypy and other type checkers. An additional argument is that soon we will have typing.TypedDict, and it would be more consistent to have both of them in the same module.

ericvsmith commented 7 years ago

Good point, that slipped my mind. It's a shame we can't harmonize them somehow, like maybe adding field() support.