Extending classes __init__behavior for newbies

Westley Martínez anikom15 at gmail.com
Mon Feb 14 18:29:04 EST 2011


On Mon, 2011-02-14 at 11:15 -0800, rantingrick wrote:
> On Feb 14, 11:55 am, Michael Sparks <spark... at gmail.com> wrote:
> > It can be broken if someone tries to use the class as is - that is
> > treating the class as a model - to drive a display of the ship. If
> > it was written using super() then that wouldn't be a problem.
> >
> > For example, I could write a display mixin that I'd like to use like
> > this:
> 
> [snip: miles of code not formatted for 79 chars!]
> 
> That was a nice long winded example of how to break code by using it
> in an improper manner. You could have just called the base with one
> too many arguments and achieved the same. However the developer would
> be suffering from either; severe memory loss and/or lack of reading
> comprehension if he tried to use -a- his class interface in a manner
> that it was not originally intended. I could likewise use a hammer to
> drive screws and then rant and rave later how the hammer is
> insufficient. Surely my methods could not be a fault, surely? ;-)
That's nowhere near a mile.




More information about the Python-list mailing list