<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Tue, 26 Dec 2017 at 21:00 Ned Batchelder <<a href="mailto:ned@nedbatchelder.com">ned@nedbatchelder.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000">
On 12/26/17 1:49 PM, Chris Barker wrote:<br>
<blockquote type="cite">
<div dir="ltr">On Sat, Dec 23, 2017 at 5:54 PM, Nick Coghlan <span dir="ltr"><<a href="mailto:ncoghlan@gmail.com" target="_blank">ncoghlan@gmail.com</a>></span>
wrote:<br>
<div class="gmail_extra">
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<div dir="auto">
<div dir="auto">I still wonder about the "fields *must*
be annotated" constraint though. I can understand a
constraint that the style be *consistent* (i.e. all
fields as annotations, or all fields as field
instances), since that's needed to determine the field
order, but I don't see the problem with the "no
annotations" style otherwise.</div>
</div>
</blockquote>
<div><br>
</div>
<div>IIUC, without annotations, there is no way to set a
field with no default.<br>
<br>
</div>
<div>And supporting both approaches violates "only one way
to do it" in, I think, a confusing manner -- particularly
if you can't mix and match them.<br>
<br>
</div>
<div>Also, could does using class attributes without
annotations make a mess when subclassing? -- no I haven't
thought that out yet.<br>
<br>
</div>
<br>
</div>
</div>
</div>
</blockquote>
<br></div><div bgcolor="#FFFFFF" text="#000000">
I have not been following the design of dataclasses, and maybe I'm
misunderstanding the state of the work. My impression is that attrs
was a thing, and lots of people loved it, so we wanted something
like it in the stdlib.</div></blockquote><div><br></div><div>Yes.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000"> Data Classes is that thing, but it is a new
thing being designed from scratch. There are still big questions
about how it should work, but it is already a part of 3.7.<br></div></blockquote><div><br></div><div>I wouldn't characterize it as "big questions". For some people there's a question as to how to make them work without type hints, but otherwise how they function is settled.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000">
<br>
Often when people propose new things, we say, "Put it on PyPI first,
and let's see how people like it." Why isn't that the path for Data
Classes? Why are they already part of 3.7 when we have no practical
experience with them? Wouldn't it be better to let the design
mature with real experience? Especially since some of the questions
being asked are about how it interrelates with another large new
feature with little practical use yet (typing)?</div></blockquote><div><br></div><div>The short answer: "Guido said so". :)</div><div><br></div><div>The long answer (based on my understanding, which could be wrong :) : Guido liked the idea of an attrs-like thing in the stdlib, but not attrs itself as Guido was after a different API. Eric V. Smith volunteered to work on a solution, and so Guido, Hynek, and Eric got together and discussed things at PyCon US. A design was hashed out, Eric went away and implemented it, and that led to the current solution. The only thing left is some people don't like type hints and so they don't want a stdlib module that requires them to function (there's no issue with how they relate <i>to</i> type hints, just how to make dataclasses work <i>without</i> type hints). So right now we are trying to decide what should represent the "don't care" type hint.</div></div></div>