Hi forum! i didnt know where to post in this forum, so well… i posted here.
Can anyone help me with a few questions on python?
Im studying with a book, but the book doesnt explain a few things… Since im a java programmer, im obviously trying to see the differences between the two languages and i know python can be procedural language too… Anyway, can anyone help me with this simple code?
class Application():
#THis is the constructor?
#Why it receives self?
def __init__(self):
print "__init__"
#Why it receives self?
def printText(self, text):
print text
class Example():
def run(self):
print "Hello, world!"
a = Application()
#Why i dont need to pass, 'a" as a first parameter
a.printText("Hi World")
# i Dont get this :
if __name__ == '__main__':
Example().run()