Dec
22

I have recently been playing around with python in my lack of “spare time”, it’s quite a powerful and very useful programming language to have knowledge of, as it’s fairly platform independent meaning no matter what servers I am working on the scripts should work, if python is installed of course.

Further more the structure of the code is designed to be “hacker friendly”, and I don’t mean that it’s great for script kiddies that want to run port scans etc, i mean it’s designed for the people that quickly want to write a program to hack together a solution for a problem, something thats probably going to give me some real world value. This can be seen when you look into the coding further:

What Semicolon?

Most program languages dont really pay much attention to how humans structure their code, this means things have to me made clear to them. An example of this is most languages will request an end of line to be marked with a semicolon “;”. Python is more intuitive and actually looks for where a new line starts/ends, therefore semicolons are now optional. Infact it’s considered bad practice by Python coders to use them at all in their scripts.

In PHP:

echo "Hello world!";

In Python:

print "Hello world!"

Belt and Braces, no thanks!

Another great example is the use of indentation, typically developers will have to wrap functions and statements in braces “{}”, they will then also indent the code using tabs/spaces to make it more humanly readable. In reality this becomes redundant as your trying to please both the interpreter and the human reading your code.

Python therefore removes the braces in favour of what humans are already going to use, indentations! Another advantage of this is your code becomes more readable, as good structure no longer becomes a best practice it actually becomes a requirement for your code to run as you intend!

In PHP:

function test(){
  echo "test";
}

In Python:

def test():
  print "test"

Finally probably one of the best things is that is so easy to learn, because they have embraced what many programers already do most of the coding becomes almost natural, and there are less language rules or idiosyncrasies to incorporate into your code.

I will probably be doing some more posts on python as my knowledge hopefully expands in it.


You can leave a response, or trackback from your own site.

Leave a Reply

Our Sponsors