python's problem is that while it goes the distance to make the simplest possible program as simple as possible, simplicity bleeds off very quickly as you add functionality. The shortest well behaved program, for example, looks like this: if __name__ == "__main__": print "Hello World!" and the shortest program that is strictly equivalent to the java program is closer to this: class Hello(object): @classmethod def mai…
class Hello(object):
@staticmethod
def main():
print "Hello World!"
if __name__ == "__main__":
Hello.main()
Your version:(1) Unnecessarily uses @classmethod instead of @staticmethod, necessitating an argument to main(). @classmethod and @staticmethod in Python are both related to Java static methods, but @staticmethod is the closest analog for Java static methods that do not depend on static member data. Just doing a one-to-one substitution of Java static to Python @classmethod indicates a lack of understanding.
(2) Doesn't actually call Hello.main() the way the python runtime does, and instead reproduces its function in the if __name__ == "__main__" block.
> Based on my experience, there's a lot people learning python who spend a lot of time at the stage where they "just don't get OO", and my opinion is that the reason is the language is bad at teaching them.
Lots of people learning Java, IME, just don't get OO for a long time, too. Obviously, they have to produce a structure with classes and methods in order to produce anything in Java, but having to use the superficial structure of OO and getting OO aren't the same thing. (If anything, being forced to use its structure for everything impairs understanding of what it is for and how to use it appropriately.)