Tuesday, August 31, 2010

Sweet Python

My first impression of Python was language that was over-hyped. Now, that I have got to experience and feel it's power, I have begun to love it.

Why not semicolons, braces, dollars, at-the-rates and all the rubbish symbols that have been so long in other programming languages.
That's the first surprise you see, when you get to know Python. Well there may be many reasons like it keeps your fingers in the home row while typing or makes the code looks beautiful. My favorite reason is that it removes redundancy-why have a semicolon when you are going to have a new line anyway; why have pair of braces when you are going to indent and de-indent anyway. I have observed that it does reduces syntax errors, especially when you are away from your favorite on the fly syntax checking IDE.

What is module, function, class, method and object? they are simply types.

Wow! this is coolest feature of Python I have learned so far: Metaclasses. Everything you can see is a type, even in the language it self. And all the classes that we understand in the usual sense are just the predecessors of the type "object". Using these with setattr and getattr, you can generate any kind of code on the fly, even that one which in-turn generates code on the fly. Of course, don't do that because it do not generates a debugger on the fly.

No comments:

Post a Comment