Okay, on Sunday I went over a list of possible programming languages to learn. It ended with me decided to learn all of them, but unsure as to what to learn first. I decided to go over each of them and figure out what I thought about them. How would I do this? What I have decided to do is see how complex it is to do the same thing in each language. What better to test out a language than to create a class?
Yesterday, I went over the Perl. Today is Python’s turn.
Python Class
class Person: def __init__(self, firstname, lastname, age): self.firstname = firstname self.lastname = lastname self.age = age def IntroduceYourself(self): return "Hello, my name is " + self.firstname + " " + self.lastname + ", and I am " + str(self.age) + " year(s) old."
Python Implementation
dan = Person("Dan", "Appleyard", 27)
print dan.IntroduceYourself()
My Thoughts
Very different than Perl, wouldn’t you agree? Seven lines of code to create the same that class that took 17 lines in Perl. I kind of like it. Indentation is key with Python. Tomorrow, I am going to go over the same class implementation in PHP. Until tomorrow then!



