Newbie inheritance question.

Jeremy Bowers jerf at jerf.org
Sun Jan 16 08:08:04 EST 2005


On Sun, 16 Jan 2005 22:08:13 +0800, bwobbones wrote:

> Hi all,
> 
>   I'm a java programmer struggling to come to terms with python - bear 
> with me!

Christophe already identified the problem, I wanted to address another
Javaism in your code, for your educational benefit.

Speaking "idiomatically" (since this is all small sample code), in Python
you'd normally code your driver as follows:

----------
import two

t = two() # or something, there's a name conflict here, too many "two"s
t.printHello()
t.printTestVar()
----------

Things that aren't objects shouldn't be forced to be objects and I don't
think there is any shame in having a non-OO top level. (I go on about this
at http://www.jerf.org/writings/bowersLaw.html#4 in more detail.)





More information about the Python-list mailing list