
Jan. 5, 2005
5:26 p.m.
On Wed, 2005-01-05 at 10:37, Glyph Lefkowitz wrote:
One approach I have taken in order to avoid copiously over-documenting every super() using class is to decouple different phases of initialization by making __init__ as simple as possible (setting a few attributes, resisting the temptation to calculate things), and then providing class methods like '.fromString' or '.forUnserialize' that create instances that have been completely constructed for a particular purpose. That way the signatures are much more likely to line up across inheritance hierarchies. Perhaps this should be a suggested "best practice" when using super() as well?
Yep, I've done the same thing. It's definitely a good practice. -Barry