<div dir="ltr"><div>It seems a suggested use is "from dataclasses import dataclass"</div><div><br></div><div>But people are already familiar with "from collections import namedtuple" which suggests to me that "from collections import dataclass" would be a more natural sounding API addition.</div><div><br></div><div>But the dataclasses module has additional APIs beyond @dataclass which clearly do not belong at the top level in collections.</div><div><br></div><div>Idea: How about making the current dataclasses.dataclass decorator function instead be a callable class instance (ie: it still functions as property, todays dataclasses.dataclass becomes collections.dataclass.__call__) with all of the current contents of the dataclasses module as attributes of a collections.dataclass class/instance singleton?</div><div><br></div><div>It feels like a more natural API to me:</div><div><br></div><div>from collections import dataclass</div><div>@dataclass</div><div>class ...</div><div><br></div><div>and the following APIs show up on dataclass itself:</div><div><br></div><div>dataclass.Field, dataclass.field, dataclass.fields, dataclass.make, dataclass.astuple, dataclass.replace, dataclass.asdict, dataclass.FrozenInstanceError, dataclass.InitVar</div><div><br></div><div>instead of being in a separate dataclasses module and being a different style of thing to import than namedtuple.</div><div><br></div><div>[ if this was discussed earlier for this pep and rejected and I missed it, my apologies, just drop me a reference to that thread if you've got one ]</div><div><br></div><div>This isn't a blocker for me.  I like having a dataclass implementation no matter how we arrange it.  If we go with what's checked in today, a top level dataclasses module, so be it.  I'm not going to bikeshed this to death it just feels odd to have such an API outside of collections but figured it was worth suggesting.</div><div><br></div><div>Part of me just doesn't like the plural dataclasses module name.  I can get over that.</div><div><br></div><div>-gps<br></div></div>