News for hackers. Stuff that matters.
Re:Python 3.7: Introducing Data Classes by metalliqaz on Wednesday April 18, 2018 @01:45PM (#16869320)
This is spot on. The design of attrs remines me a little bit of the syntax from a declarative ORM, for example. I'm sure it can do very powerful things that I've not had occasion to use, but it is heavy. The @dataclass format is very clean and seems more like the syntactic sugar that I expect from Python.

One of the prime uses of a dataclass is to be a mutable namedtuple. And the syntax can be almost identical:

    Part = make_dataclass('Part', ['part_num', 'description', 'quantity'])
(from Raymond Hettinger's twitter)

This has the added benefit of not requiring type hinting, if you don't want to bother with such things.

Re:Python 3.7: Introducing Data Classes by froztbyte on Wednesday April 18, 2018 @02:18PM (#16869628)
in a freshly created venv, with attrs and ipython (and deps, of course):

  (attrs) % ipython
  Python 2.7.14 (default, Oct 19 2017, 23:28:49)
  Type "copyright", "credits" or "license" for more information.
  
  IPython 5.6.0 -- An enhanced Interactive Python.
  ?         -> Introduction and overview of IPython's features.
  %quickref -> Quick reference.
  help      -> Python's own help system.
  object?   -> Details about 'object', use 'object??' for extra details.
  
  In [1]: import attr
  
  In [2]: Part = attr.make_class("Part", ["part_num", "description", "quantity"])
  
  In [3]: Part?
  Init signature: Part(self, part_num, description, quantity)
  Docstring:      <no docstring>
  Type:           type

Outside of the name of the thing that creates the item, the syntax is identical to what you have here.

edit: removed triple backticks, indented with 2sp according to https://news.ycombinator.com/formatdoc rules