jump to navigation

Python.. ssSSssSSShhhHHHHhh October 8, 2008

Posted by leppastar in Uncategorized.
Tags:
trackback

As a BS Computer Science student, I’ve encountered many programming languages. C, Java, Assembly, Oz, Lisp, Prolog and many more. Recently, I’ve learned another language. And so far, it’s my favorite. It’s none other than Python.

I’ve just learned Python so my comparison here is not really in-depth.

Anyway, here are the reasons why I love Python:

1. It has no ending marker. In other languages like C and Java, you must each statement or expression with a semi-colon. In Prolog, you must end it with a period. In Python, just finish your statement and you’re done.

2. Blocks are not enclosed with parenthesis or curly braces. In C and Java, each block is enclosed in curly braces. Every condition is enclosed inside a parenthesis. In lisp, everything is enclosed in parenthesis. There’s just no end in parenthesis. On the other hand, in python, no more curly braces nor parenthesis for blocks. All you have to do is to indent it properly. Wish you would normally do with other languages. Besides, more readable if it’s indented.

3. It’s dynamically-typed. Just like lisp, prolog and oz, you can create variables instantly. You don’t have to assign its type. Plus, you can change its type. For example, you used it as an integer. You can use it next time as a string. Just assign a new value to it and it’s type is automatically changed.

4. It’s very high-level. You don’t have to concern yourself with low-level stuffs like the inner workings of for-loops or sorting algorithms. Most of the functions you need are already built-in. You just have to search it using the help function. Hence, more time for devising algorithms and less time for coding. hehe.

5. You can create list/tuple/dictionary of different types. For example, you can create a list with an integer, a string, and a list. The size is not even fixed. You can even extend it (though not on tuples). You can create an initial list and not concern yourself with the other contents. Plus, list functions are also built-in.

That’s it for now. I’ll post another blog once i get to know it better. But so far so good. I love it and i still am lovin’ it. Hope you love it too!

About these ads

Comments»

1. David Goodger - October 9, 2008

Welcome to the Python world!

Re #3, the difference is deeper than you think. Python doesn’t have variables like C/Java/etc., it has names and objects. The types of objects don’t normally change. Read the 3 sections starting here for details:

http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html#other-languages-have-variables

Learn this now to avoid confusion later.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: