Why Python?

I have been asked this question more than once. My answer is pretty simple. Try it for a few days. Pick a few sample problems and try them out. Convert problems from your existing language and feel the difference.

Python is a very high-level language. You can choose your style – imperative, object-oriented or functional. You can even mix them up.

For me, it is very personal. Many people I respect and admire are Python programmers. Some times I look at the sheer elegance of the solutions and almost cry with joy. That is good enough. A bit of my background. I come from a variety of language backgrounds. Started programming when there was no assembly language (in direct machine code), to Basic Plus, Cobol, C, Visual Basic, and a small dose of Java. I don’t program a lot. I wish I did. Programming requires focus, attention and lots of patience and deep thinking.

I thought the best way to tell people why they should look at Python, is to find why others love it and put it all down in this place.

From the book “Programming Collective Intelligence.”

All the example code in this book is written in Python, an excellent, high-level language. I chose Python because it is:

  • Concise -Code written in dynamically typed languages such as Python tends to be shorter than code written in other mainstream languages. This means there’s less typing for you when working through the examples, but it also means that it’s easier to fit the algorithm in your head and really understand what it’s doing.
  • Easy to read – Python has at times been referred to as “executable pseudocode.” While this is clearly an exaggeration, it makes the point that most experienced programmers can read Python code and understand what it is supposed to do.
  • Easily extensible – Python comes standard with many libraries, including those for mathematical functions, XML (Extensible Markup Language) parsing, and downloading web pages. The nonstandard libraries used in the book, such as the RSS (Really Simple Syndication) parser and the SQLite interface, are free and easy to download, install, and use.
  • Interactive – When working through an example, it’s useful to try out the functions as you write them without writing another program just for testing. Python can run programs directly from the command line, and it also has an interactive prompt that lets you type in function calls, create objects, and test packages interactively.
  • Multiparadigm – Python supports object-oriented, procedural, and functional styles of programming. Machine-learning algorithms vary greatly, and the clearest way to implement one may use a different paradigm than another. Sometimes it’s useful to pass around functions as parameters and other times to capture state in an object. Python supports both approaches.
  • Multiplatform and free – Python has a single reference implementation for all the major platforms and is free for all of them. The code described in this book will work on Windows, Linux, and Macintosh.

Please take a look at the Python Resource Page for starting points, useful links and self-paced learning.

One thought on “Why Python?”

Leave a Reply