Extending classes __init__behavior for newbies

rantingrick rantingrick at gmail.com
Tue Feb 15 00:32:18 CET 2011


On Feb 14, 1:45 pm, Michael Sparks <spark... at gmail.com> wrote:

> I hardly call 87 lines of code "miles of code" though myself.  I call
> it a relatively trivial example aimed at showing the benefit of using
> super() in your code rather than hard coding brittle fragility into
> your code.

You accuse my coding habits of being "brittle" yet you had to go to
extraordinarily lengths to break my "fragile" code. Not even
considering that my "habit" of hard coding the base is perfectly legal
and accepted in Python code. And did you read the link Ian Kelly's
provided?

In any event, normally i would expect people to use a bit of common
sense when wielding an interface ESPECIALLY when they wrote it! Like
for instance... If i gave someone a loaded gun i would not bother
telling that person "Hey, don't aim the gun at your foot and then pull
the trigger because you could blow your pinky toe off"... no, i would
expect them to have enough sense not to do such a stupid thing.
However, if they *did* happen to blow their pinky toe off i really
would not get too upset about it. After all, i've always believed that
stupidity should be painful.

> No, it was a thought out example of how writing code slightly
> differently from how you do now can result in something more
> practical, reusable, extendable, and maintainable.

Those who write code bases should "design-in" practicality, re-
usability, and extendability as a forethought and NOT an afterthought.
Of course i am not suggesting that everyone must be clairvoyant.
However the vast amount of time involved in a coding project should be
spent in the design and testing phases and NOT actually writing code.
If you spend more time writing code you are not being professional,
you are being sloppy -- and it WILL catch up to you.



More information about the Python-list mailing list