News for hackers. Stuff that matters.
Re:The Sororicide Antipattern by porpoisemonkey on Thursday June 01, 2017 @01:41PM (#14462551)
Two nitpicky comments.

> Even if, right now, we were to change it to _note2, the maintainer of A could, in any future release of A, add a new _note2 variable which conflicts with something B is using.

This is why Python offers actual namespacing of properties and methods in the form of a double underscore (__). Double underscore prepends an underscore and the class name to the private property name which prevents these sorts of collisions.

  class Bprime(object):
     def __init__(self, a):
         for var in dir(a):
            setattr(self, var, getattr(a, var))
> Uh oh. Looks like composition is worse than inheritance.

This is not composition.

Re:The Sororicide Antipattern by akud on Thursday June 01, 2017 @01:57PM (#14462709)
Yea, this is actually inheritance - it's a mixin.
Re:The Sororicide Antipattern by gipp on Thursday June 01, 2017 @09:45PM (#14466816)
> This is not composition.

That's basically the author's point.

> Once I understood what they meant by “composition”, I was even more surprised to find that I agreed with this assertion.

Re:The Sororicide Antipattern by porpoisemonkey on Friday June 02, 2017 @02:47AM (#14467971)
Good point - I think I misunderstood the purpose of the article. I'll leave the original comment as a matter of record.