Why Python

Categorized Under: Development, English 5 Commented


Why Python

I am used to programe in Java at home and on almost all my personal projects , in my work place i am a C# guy (well in work place they only use .NET :( ) and this is because in college days all we have been exposed to were OO languages like C++, Java, .NET and that what we are using till now.

As scripting languages, developers around here are far away from them, may be the only scripting language used heavily in this side of the world is PHP, and the most powerfull JavaScript and thats it. I decieded that i want to learn a new programming language and it has to be a scripting language this time, i was looking for Ruby,pearl & python to learn one of them. Finally my choice was python and thats why i hope i will be able to put small tips and tricks of what ever i learn in python here on this blog.

In this blog i am just talking about why i am intrested in learning python , well first since i am used to java and C# and they are statically typed languages I don’t experiance a lot the beauty of dynamically typed language where i dont have to declare variables or specify its type, also in dynamically typed language i will be able to use a variable as integer and after few lines i will use it as string , then again i can use it as an object of my class called money, or what ever else very easily.Another benifit of dynamic typing is that i can have a set, an array that contain compeletly different types of variable that while retriving them i dont have to cast them to their types which really simplifies a lot of rutine work

Other than being dynamically typed language python is very compact compared to java & C#, so typing is less, what ever you type in python will be used to solve your problem not the language problems as in the big OO languages

lets say i want to create a class constractor that meight take a variable or two variable, or three variables.

do that in java do that in python
public class MyclassName{

public MyclassName(String var1)  {      this(var1, 1);  }

  //--------- constructor #2 -------------  public MyclassName(String var1, int var2)  {     this(var1, var2, "single");  }

  //--------- constructor #3 -------------  public MyclassName(String var1,         int var2,         String var3)  {     this.att1= var1;     this.att2= var2;     this.att3= var3;  }
class MyclassName():

  def __init__(self,      var1, var2=1, var3="single"):

      self.att1= var1       self.att2= var2      self.att3= var3

to open file in java
to open file in python 
BufferedReader br=  new BufferedReader(      new FileReader(filename));
fileName = open(filename)

so i think if i master python or any similler language (Ruby, pearl) i will have to type less and be able to concentrate more on solving the problems i am working on.

Another new thing in this kind of language is they support functions as first class entity in the language, so functions could be stored in data structured and passed as arguments to other functions (not as pointers like in C++) Also functions could be created dynamically while the programe is running which i am sure will be very usefull, i have never though of using a dynamically created functions since none of my programe worlds supported that before. if you are new to this like me and need example check this

well i guess after all of these reasons it still didnt come to python, cause these reasons just show i want to learn an scripting language with the mentioned properties that could be any of Perl, Python, PHP, Lua, Tcl/Tk, ECMAScript (JavaScript, ActionScript), Ruby, Io, Scala, or Nemerle. I guess then it is true i wanted to learn python just because it is python :) may be another reason is it is very known, supported heavily by Google, in their app engine !

to be honest i was thinking about ruby too. but after some search i found some information that made me like python more that are many blogs says the error messages in ruby compiler are not very much informative compared to python. Another reason is there is a lot of ways of doing the same thing in ruby which is good but can make a new language somewhat confusing. Also the fact that GUI libraries for Ruby they are very limited and in python there are a lot of libraries + default librari that comes with python itself

so i prefered python .so hope fully i will be able to put some small python tips or tutorials as soon as possible.

No related posts.

5 Responses to “Why Python”

  1. Hassan AL-Marhoon says:

    It is a good motivation to learn python, I think I should change my plan for this winter holiday by adding “Learn Python” to the To-Do-List.

    And I hope to create a good application to run under Google App Engine platform.

    thanks Ali for the blog.

  2. Ali Hassan Al Lawati says:

    welcome , hassan and thanks for your comment

    by the way , i started few things in python, and i think one of my next blogs will be things i hate , like in python :)

    do you believe the latest “stable” reliese of python still don’t have ability to talk to MYSQL in the requler way that is used normally !!!!!

  3. megat says:

    Hi!! Your blog are very nice and more info. I hope follow my blog and please click my google ads

  4. Ali Hassan Al Lawati says:

    Hi Megat, thanks fo the compliment

  5. Your blog came up in my research and I’m impressed by what you have published on this subject. I am presently widening my inquiry and thus cannot contribute further, nonetheless, I have bookmarked your web site and will be returning to keep up with any upcoming updates. Simply love it and gives thanks for granting my remark.

Leave a Reply