Posted: - Updated:

Learning Python as a Front End Developer

Categories Python
Learning Python as a Front End Developer

In this article we’re going to go over a Front End Developer’s first impressions of the Python programming language. I’ll try to keep things as objective as possible, but do keep in mind that it’ll be permeated by my own opinions.

That being said, if you’re shopping for a new language to learn next, perhaps I can be of some assistance.

It’s been a crazy couple of months, and I’ve barely had any time to breathe. Part of the reason for that is because I finally moved back to my hometown of Merida Yucatán. Something which I’m extremely thankful for. But that also took a lot of my everyday time.

The other part is because I took it upon myself to become a Full Stack Developer at my new job. And that (in my case) meant learning Python. Which proved to have to be a little bit of a challenge.

I was a PHP guy before JavaScript took over my life, so it wasn’t my first time changing languages. But that doesn’t mean it wasn’t challenging. Being used to the Front End way of things probably didn’t help.

So, after a couple of months getting to know Python, I figured I’d talk about what I learned. And, while I don’t think you can ‘review’ a programming language, perhaps my experience can be of use to someone else.

Let’s get started.

JavaScript and Python are very similar.

If you’re coming in from JavaScript, you’re already 50% there. Don’t believe me? Let’s take a look:

  • First of all, both languages are dynamically typed.
  • Need a collection of keys and values? In JavaScript you’d use an object literal {}. In Python? A dictionary {}.
  • Then, how about one that only has values? You’re looking for a JavaScript array []. Or perhaps a Python List [].
  • Also, did you know both have first class functions? Hello Functional Programming.
  • What about flow control? For loops look identical. And the same can be said about while
  • However, if... else blocks differ slightly: you use elif instead of else if. Everything else stays the same.

Note: If you’re interested, Atul Varma even wrote a whole article about the similarities. You can find it here.

And there’s a lot more where that came from. There’s definitely an argument to be had about how JavaScript has become more Python-like over the years.

Python and whitespace.

Every discussion about taking up Python will eventually address this topic. Which is something I find very fascinating for the simplest of reasons.

And that reason is that: Yes, Python needs whitespace to understand your code. But, so does everyone.

To explain my point, let’s have a look at a JavaScript function:

function sum(x, y) { 
    return x + y; 

We don’t really need the white space to understand what is happening. But it sure helps.

So now, let’s look at this same function in Python:

def sum(x, y):
    return x + y

Which is just as understandable, and we even reduced the amount of code.

Python took a very useful industry standard and made it one of its cornerstones. Meaning that, by having us do something (that we were already likely to do), it actually helps us produce cleaner code.

Modules, Virtual Environments and PIP

When it comes to modules, Python uses a very similar syntax to ES6. Although it does have one very important difference: it doesn’t use export statements.

Which means that you can pretty much import anything from everywhere. And that’s just the best thing ever.

The syntax is a little bit different though: from path import something vs import something from path. I think I’ll survive.

Moving on, PIP works just the way you’d expect NPM to do so: pip install module. Although I do miss my NPM scripts quite a bit (You could just make shell ones though.)

And finally, what really surprised me about Dependency Management in Python: Virtual Environments.

For those unfamiliar, a Virtual Environment is just like a separate workspace. It keeps track of all of your dependencies, environment variables and what not. And you use them for the same reason you use namespaces in code: so you don’t pollute your globals. Which, in this case, mean your local site-packages directory.

Now, I’m coming in from the world of Front End Development. Which means I’m pretty used to just having a node_modules folder and calling it a day. So, finding this extra layer of complexity was very surprising for me.

The weird thing (for me) was having to initialize my virtual environment to start coding. And having to switch to another one when I wanted to work on another project.

I guess it’s just one of those things you get used to.

A few more points and a conclusion.

  • I find that there’s a lot more magic in Python, which leaves me with unrealistic expectations.
    • To elaborate, fixtures in PyTest are simple functions or constants. You can define them in a file called and all other files in your folder will magically have access to them afterwards.
    • And, to further elaborate, this left me expecting for my resources to be automatically added as paths on my rest service (as opposed to directly stating them to be so.) Like I said, unrealistic expectations.
  • I also found the standard assert library to not be of my liking. For those interested, expects is a library that uses much of the same syntax as chai does.
  • Error messages are a lot more verbose than what I’m used to in JavaScript. But I find this to be more of a Back End vs Front End difference.
  • Finally, I really appreciated having an IDE to work with Python (I’m using Pycharm.) Which is something I find very odd since I’ve never felt the need for one in JavaScript. Make of that what you will.

And that pretty much leaves us with only one question: do I recommend Python? The answer to which is yes. Yes, in general, even if you’re not coming from a Front End Development background.

The language was made with the intention of being a joy to work with. Something which I can attest to since I’ve been having a blast these past 2 months getting to know it. And I plan to continue doing so.

Please let me know in the comments if you have any ideas, thoughts or advice for people learning Python. And I’d also love to hear your experiences learning new programming languages as well.

See you guys next week!

My name’s Orlando Paredes Hamsho. I’m a 25-year-old Web Developer living (mostly) in Guadalajara, Mexico; albeit I intend to move pretty soon. Apparently, I also run a blog now, and have been doing so for a while.

6 thoughts on “Learning Python as a Front End Developer

      1. I was a PHP developer at Hermosillo, and I needed to write a script for some tasks. I found ruby really cool for that and then I search other languages with “Monkey Patch” examples, so I found Javascript. I was a backend developer using Jquery, so I didn’t like javascript, but I found very similar to Ruby (because in js you work a lot with literal objects and Ruby everything is an object).

        Now, I’ve been playing with node and javascript, founding really cool stuff like RxJS, React and every new library/framework/tool every day, hehehe.

        At Guadalajara I found my first job as Front End developer, almost 2 years now and I’m very excited with the language.

Leave a Reply

Your email address will not be published. Required fields are marked *