Re:The Sororicide Antipattern
by gweinberg on Thursday June 01, 2017 @05:21PM
(#14464895)
class Bprime(object):
Has anyone ever done such a thing? Why?
[ Parent
| on HN ]
Re:The Sororicide Antipattern
by thesmallestcat on Thursday June 01, 2017 @10:03PM
(#14466884)
It's blindingly wrong. It creates a mutable snapshot of the other object. Depending on the size of `a` and how many instances are being wrapped in this way, it could increase memory footprint substantially. I can't imagine a time where you'd want to do this. This sort of effect is usually achieved by a __getattribute__ that falls back to whichever object(s) are being shadowed. Not that that's ideal, but weird to see somebody who knows Python so well throw out such a useless example.