On Fri, Dec 22, 2017 at 11:40 AM Chris Barker <chris.bar...@noaa.gov> wrote:
> On Fri, Dec 22, 2017 at 8:49 AM, Brett Cannon <br...@python.org> > But I think the key point I want to make is Guido chose dataclasses to >> support using the type hints syntax specifically over how attrs does >> things, so I don't see this thread trying to work around that going >> anywhere at this point since I haven't seen a solid alternative be proposed >> after all of this debating. >> > > And the PEP has been approved. > > So the actionable things are: > > Writing good docs > > Converging on a "recommended" way to do non-typed dataclass fields. > My preference for this is "just use Any" for anyone not concerned about the type. But if we wanted to make it more opaque so that people need not realizing that they are actually type annotations, I suggest adding an alias for Any in the dataclasses module (dataclasses.Data = typing.Any) from dataclasses import dataclass, Data @dataclass class Swallow: weight_in_oz: Data = 5 laden: Data = False species: Data = SwallowSpecies.AFRICAN the word "Data" is friendlier than "Any" in this context for people who don't need to care about the typing module. We could go further and have Data not be an alias for Any if desired (so that its repr wouldn't be confusing, not that anyone should be looking at its repr ever). -gps > > And that should be decided in order to write the docs, (and probably > should be in the PEP). > > -CHB > > > -- > > Christopher Barker, Ph.D. > Oceanographer > > Emergency Response Division > NOAA/NOS/OR&R (206) 526-6959 voice > 7600 Sand Point Way NE (206) 526-6329 fax > Seattle, WA 98115 (206) 526-6317 main reception > > chris.bar...@noaa.gov > _______________________________________________ > Python-Dev mailing list > Python-Dev@python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > https://mail.python.org/mailman/options/python-dev/greg%40krypto.org >
_______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com