News for hackers. Stuff that matters.
Re:Grumpy: Go running Python by jonasvp on Wednesday January 04, 2017 @02:40PM (#13321367)
Attrs (https://attrs.readthedocs.io/) replaced namedtuple for us (and many others). It's slightly more verbose but allows all class goodness such as methods, attribute validation, etc.
Re:Grumpy: Go running Python by justinsaccount on Wednesday January 04, 2017 @02:53PM (#13321472)
Doesn't work for everything, but you can subclass a namedtuple:

  from collections import namedtuple
  
  class Foo(namedtuple("Foo", "a b c")):
      @property
      def sum(self):
          return self.a + self.b + self.c
  
  
  f = Foo(1,2,3)
  print f.sum
Re:Grumpy: Go running Python by brianwawok on Wednesday January 04, 2017 @03:34PM (#13321807)
That doesn't look super awesome to me. I.e. classes or attrs both seem better.
Re:Grumpy: Go running Python by foxylad on Wednesday January 04, 2017 @10:11PM (#13324391)
Aaaaaarrrrrgggggh! I've had that particular itch for every one of my ten years with python, and at last I get to scratch it!

Thanks so much for bringing it up.