Python - What I learned switching stacks
4 min read
September 20, 2025
To give you a disclaimer, I don't have any production-level experience in Python and its frameworks. As a full-time developer, I have always used either JavaScript or TypeScript in my production work. When I say JavaScript, I used it when I was learning programming. It was pretty hard for me since I didn't take any computer-related courses during my school and college time. But it gave me a strong foundation to learn and use TypeScript in most of my projects. I am still enjoying whenever I use TypeScript in my projects as it catches all the errors during development itself.
I tried Python today. Before writing basic code in Python, I thought it would have completely different syntax than JavaScript. But I had already made up my mind that it wouldn't ask me to write more lines of code to execute something simple. As everyone on the internet says, I have to agree with that. I felt like the Python programming language completely hates curly braces. It felt weird to write functions without curly braces. I couldn't control myself from typing them. Even when you destructure keys from an object, it doesn't use curly braces. Somehow, they decided to keep them in objects. When it comes to type definitions, it didn't force me to give types for variables. It felt strange in the beginning, especially when you come from a TypeScript realm. One more thing was, the import statement felt as if we are speaking to somebody. It didn’t come in handy as I used to typescript imports.
Apart from that, there are a lot of shared concepts and syntaxes which helped me draw parallels between JavaScript and Python. It took me very little time to set up Python on my machine since I installed it through Homebrew. Creating a virtual environment for the project is kind of new to me. I don't remember creating something like that while I was working on JavaScript projects. Virtual environments help avoid dependency version issues. Virtual environments are recommended for project isolation, though you can use pip commands without them.
python3 -m pip install virtualenv
python3 -m virtualenv env
A couple of days back, I used Nest.js to understand microservices a bit. It followed the same MVC pattern like Node.js with its own set of syntax variations. But I would say Nest.js and FastAPI share similar syntaxes when it comes to writing controllers for endpoints, which is quite different from writing middleware in Node.js. Surprisingly, I was able to create standalone services without even creating a port in Nest.js. The TCP protocol allowed me to do that. This is also possible in FastAPI. However, I have to create classes in order to write controller stuff in Nest.js. But it's not at all necessary in FastAPI. You can define an endpoint to serve your needs.
Django, Django Ninja, FastAPI - these are three popular frameworks in Python. I tried using Django first without using React as a frontend. I used HTML templates to develop frontend elements. Django provides its own template engine to execute template logic inside HTML. If you have used template engines like Handlebars or EJS in Node.js, you'd get a clear idea of it. Django as a full-stack framework with prebuilt admin configuration will help you focus more on app features rather than login/signup/role-based authentication.
// Django
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Home</title>
</head>
<body>
{% extends 'main.html' %} {% block content %}
<h1>Hello world</h1>
<ul>
{% for room in rooms %}
<li>{{room.name}} -- {{room.id}}</li>
{% endfor %}
</ul>
{% endblock content %}
</body>
</html>
// EJS
<div class="main-container">
<%- include('../layouts/header.ejs')%> <%-
include('../layouts/navigation.ejs')%> <% if(todos.length > 0){%> <%
todos.forEach(fav=>{%>
<div class="todo-items">
<h1><%= fav.todo %></h1>
<p><%= fav.description%></p>
<div class="action-btns-3">
<form action="/add-to-favourites" method="POST">
<input type="hidden" value="<%= fav.id %>" name="todoId" />
<button type="submit">Add to Fav</button>
</form>
<%- include('../layouts/completedTodos.ejs',{fav:fav})%>
<a href="/show-todo-details/<%= fav.id %>">Detail</a>
</div>
</div>
<%} )%> <% } else { %>
<h1 class="no-items-desc">No todos are created</h1>
<% } %>
</div>
<%-include('../layouts/footer.ejs')%>
Overall, it was nice and easy to use Python in your full-stack application if you are a JavaScript developer. However, as the application grows, we have to tackle the complexities that come with it. I'd recommend you try this language. There is nothing to be scared of when it comes to syntax and concepts. When you draw parallels between JavaScript and Python, it is easy to learn and understand new concepts well.