Python: Taking Over?

According to The Popularity of Programming Languages, an index that uses the frequency of Google searches for a language’s tutorials to measure popularity, Python is second only to Java. This came as a bit of a surprise to me mostly because of what I’ve been exposed to recently in the web development field. I had been looking for a good opportunity to start on a new language and an article that brought the aforementioned index to my attention seemed like as good a reason as any! I started off by doing a quick search to find out some of the pros and cons of Python as a language. What I found mostly reinforces those notions so lets start with the basics and then outline the specs.


Python is an object-oriented language and there is no need to declare variable or their type before you use them. These variables can be integers, floats, complex numbers, strings, lists, or an object of one of your own classes. Strings can be added together as well as numbers but you cannot mix the two. If you have any experience with Ruby this will all sound familiar. In my early experience with the language I have not encountered any abnormally strange behavioral quirks of Python’s variables but I’m sure that’s just due to my lack of exposure.

String Interpolation

Speaking of strange behavior, the way Python handles string interpolation really threw me for a loop when I first saw it. As used to as I am to directly dropping my variables between either a ${} or #{} and leaving it up to the language to interpret them, this is not the case in Python. The best way to outline how it works is to show it so that’s exactly what I’m going to do.

This just didn’t feel right.

The %s will let Python know that you are going to pass it a value that is to be treated as a string. Then we pass in the term that we want to replace the %s in our string. You can also add %d for an integer, %f for a float, or %..f where the .. is replaced by the number of digits after the zero you would like the float to be accurate to. This syntax is called C-style string formatting and feels bulky to someone who is spoiled by Ruby and Javascript.

There is another, more modern way to interpolate values directly in to your strings and I couldn’t be more thankful. It is the format() method which reads more intuitively.

Still seems unnecessary.Bl


All of the other programming languages I’ve used extensively have had a way to denote the beginning and end of a block of code. Whether it be the curly brackets {} of many languages or the do…end of others, they seem to be a staple. This is why Python’s block form seemed so alien at first, it used the tabbing of the page to denote the blocks rather than any specific characters.

This was my first time looking into the Python language so I’m excited to learn more so that I can come back here to expand and update this post! Stay tuned, thanks for reading.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.