Headline: From MERN to Python 🐍 | Day 1 Reflections Hello Connections , I’ve officially started my journey into Python for FastAPI integration! Coming from a MERN background, the first glance feels incredibly "clean," but there are some fun mental shifts required. Here’s my Day 1 breakdown of Python for the JavaScript developer: 1️⃣ No var, let, or const: It’s just name = value. Also, forget hoisting—Python is strict. If you don't declare it before you use it, it crashes. 2️⃣ Functions: Swap function name() {} for def name():. No curly braces here; the indentation is the logic! 3️⃣ Arrays vs. Lists: JS Arrays are now Lists. 4️⃣ The Tuple: A concept we don't have natively in JS—think of it as an Immutable Array that can’t be changed once born. 5️⃣ Objects vs. Dicts: Objects are now Dictionaries (dict). Pro-tip: Keys must be strings in Python! 6️⃣ Template Literals: Move over backticks; f-strings (f"Hello {name}") are the new standard for interpolation. 7️⃣ Sets: new Set() becomes a simple {value1, value2} or set(). Great for unique values. 8️⃣ Built-ins: len() replaces .length, and enumerate() is the go-to for getting indexes in loops (goodbye manual counters!). 9️⃣ Spread Operators: Passing **dict into a function is the Pythonic way of spreading an object into parameters. 🔟 The "Loop" Logic: No {} means the end of a function or loop is defined by the indentation. It’s a bit of a mind-bend at first, but it forces very readable code. 😅 Python feels like "Executable Pseudocode." I’m looking forward to seeing how these features power FastAPI. Any Python pros have tips for a JS dev making the switch? Drop them below! 👇 #Python #Javascript #MERN #FastAPI #WebDevelopment #CodingJourney #LearningInPublic
Python for FastAPI: MERN Dev's Day 1 Reflections
More Relevant Posts
-
Event Loops: Node.js vs Python - The Party Where Code Gets Things Done Ever wondered how Node.js can juggle thousands of requests without breaking a sweat, or how Python keeps up with async magic? Let’s peek behind the curtain and see what’s really happening… Node.js – The One-Man Band 🎸 Node.js is single-threaded, which sounds scary at first. How can one thread handle so much? Enter the event loop — the ultimate multitasker. Think of it like a super-efficient bartender at a busy club: Timers – “Okay, who ordered a setTimeout?” Pending Callbacks – “Ah, your file read just finished, here’s your drink!” Poll – “What new requests do we have in the queue?” Check – “setImmediate calls, coming right up!” Close Callbacks – “Bye, socket! Hope you had fun!” Microtasks like Promises are like VIP guests — they always get served before regular timers, no matter what. Takeaway: Node.js doesn’t block. While one task waits on I/O, the bartender is already serving everyone else. 🍹 Python – The Chill Club with Asyncio 🐍 Python started as a sync-first language — one request at a time. But with asyncio, it learned some slick dance moves. The event loop in Python is explicit: you start it with asyncio.run() and schedule tasks with await. Each async function yields control back to the loop when waiting on I/O. It’s like a team of bartenders taking turns efficiently serving drinks, but you have to tell them when to step aside. Python’s async is a bit more hands-on: you decide when to pause, resume, and gather tasks. Node.js does it more automatically behind the scenes. #NodeJS #Python #AsyncProgramming #EventLoop #JavaScript #Asyncio #WebDevelopment #FullStackDevelopment #ProgrammingTips #SoftwareEngineering #ScalableApps #DeveloperLife #TechInsights
To view or add a comment, sign in
-
-
𝗣𝘆𝗦𝗰𝗿𝗶𝗽𝗍: 𝗥𝘂𝗻𝗻𝗶𝗻𝗴 𝗣𝘆𝘁𝗵𝗼𝗻 𝗗𝗶𝗿𝗲𝗰𝘁𝗹𝗲𝘆 𝗜𝗻 𝗧𝗵𝗲 𝗕𝗿𝗼𝘄𝗌𝗲𝗿 Web development used to be all about JavaScript. Python developers had to use backend frameworks or transpilers to bring Python to the web. PyScript changes this by allowing Python to run directly in the browser. You can write Python code that interacts with the browser, processes data, and renders UI without writing JavaScript. PyScript is built by Anaconda, the organization behind the popular Python distribution. Before PyScript, running Python on the web meant: - Writing a backend API - Using JavaScript frameworks for frontend logic - Bridging Python and JavaScript through APIs PyScript removes this separation by enabling client-side Python execution. This unlocks: - Python-first web applications - Browser-based data science and visualization - Educational and interactive Python content - Rapid prototyping without backend infrastructure PyScript uses WebAssembly to execute Python efficiently in the browser. It includes: - WebAssembly Runtime - Pyodide, a Python distribution compiled for the web - HTML Integration, allowing Python execution and DOM manipulation You can load Python packages directly in the browser and use them for data science. PyScript is not a JavaScript replacement, but a complementary tool. It's suitable for: - Interactive Python tutorials - Live coding notebooks in the browser - Browser-based analytics dashboards - Lightweight data exploration tools However, PyScript has constraints, such as slower execution than native JavaScript. It's production-capable for specific use cases, like internal tools and educational platforms. Use PyScript if you are Python-first, want browser-based data processing, or are building interactive educational tools. Avoid it if you need ultra-low latency or are building large-scale consumer web apps. Source: https://lnkd.in/gG5_b_3g
To view or add a comment, sign in
-
🔥 90 Days of Python Full Stack – Day 51 Django Templates & Dynamic Rendering Today was about bringing the backend to life. After creating models and performing ORM queries, the next step is showing that data in the browser — dynamically. This is where Django Templates come in. 🔹 What I Learned ✅ How Django templates work ✅ Template syntax: {{ variable }} for dynamic data {% for %} loops {% if %} conditions ✅ Passing data from views → templates ✅ Using render() to send context data ✅ Displaying database records dynamically ✅ Template inheritance using base.html 🔄 Data Flow I Practiced Model → View → Template → Browser Python def product_list(request): products = Product.objects.all() return render(request, "products.html", {"products": products}) And inside the template: HTML {% for product in products %} <li>{{ product.name }} - {{ product.price }}</li> {% endfor %} That moment when database data appears in the UI 🔥 💡 Why This Is Important Now the app is: ✔ Not static ✔ Not hard-coded ✔ Fully dynamic ✔ Connected to real database data This is the core of real-world web applications. Day 51 complete. Backend + Frontend communication unlocked #90DaysOfPython #Django #FullStackDevelopment #LearningInPublic
To view or add a comment, sign in
-
-
I've been writing Python backends for a while now FastAPI and Django. Setting up CORS, configuring headers, handling requests... I could do it all. But I was just copying configurations without really understanding them. Then I hit video 5 of "Backend from First Principles" by K Srinivas Rao aka Sriniously. 🤯 Mind. Blown. HTTP headers finally make sense. Not just "add this header to fix CORS errors" but WHY CORS exists, what's actually happening in that preflight request, what each header is communicating between client and server. I've configured CORS hundreds of times. But I never truly understood what I was doing until now. I'm only 8 videos in (out of 23), and already my debugging approach has changed. When I see a CORS error now, I don't just Google the fix, I understand what's breaking and why. The best part? This isn't Python-specific or framework-specific. I'm planning to learn Spring Boot next, and I know these fundamentals will transfer directly. If you're a backend dev who learned by building (like most of us), this series is gold. It fills in all those gaps between "I can make it work" and "I understand how it works." Link in comments 👇 What made things click for you? Always looking for good resources to dive into. #BackendDevelopment #Python #WebDevelopment #ContinuousLearning #FirstPrinciples
To view or add a comment, sign in
-
-
Python math is simple. Concurrent clicks are not. Imagine you are writing a simple view counter for an article: -> article = Article.objects.get(id=1) -> article.views += 1 -> article.save() This looks perfectly fine at first glance, but it’s a trap for Race Conditions. If your app has concurrent traffic, the numbers simply won't add up, and you will start losing views. Here is why: If User A and User B open the article at the exact same time, they both read the current state, let's say views = 10. Both of their Python processes independently calculate 10 + 1 = 11. Both save 11 back to the database. Two people visited, but the counter only went up by one. To avoid this, you should stop doing the math in Python memory and let the database handle it. In Django, we can use F() expressions for this: -> from django.db.models import F -> Article.objects.filter(id=1).update(views=F('views') + 1) This translates into a single, safe SQL query: UPDATE table SET views = views + 1 Now you are telling the database: "Just add 1 to whatever the current value is." The database is smart enough to safely lock the row and apply the updates sequentially. Don't forget, the .update() method works directly with the DB. This means if the "article" object is already loaded in Python memory, its views attribute won't magically update. If you need the actual updated value later in your code, simply call "article.refresh_from_db()". If multiple requests can change the same number simultaneously, don't trust Python's memory. Trust the database. #python #django #database #concurrency #backend
To view or add a comment, sign in
-
Python teaches boundaries in the most unexpected ways 😅 Functions really have personalities: Local variables: “I’m only here for this function.” They live inside a function and disappear once it’s done. Global variables “I belong to everyone.” Accessible anywhere in the file… but if you modify them carelessly, your whole program feels it. Nonlocal variables “I’m not global, but I’m not just local either.” They live in an outer function and can only be modified in an inner function if you explicitly declare nonlocal. Here’s what stood out to me: Coming from JavaScript, I was used to closures just working. In JavaScript, if an inner function sees a variable in its outer scope, it can modify it directly. No special keyword. In Python? If you want to modify a variable from an enclosing function, you must explicitly say nonlocal. If you don’t, Python quietly creates a new local variable instead. Same concept. Different philosophy. JavaScript assumes intent. Python requires you to declare it. And that small difference changes how you think about state, structure, and responsibility in your code. Scope isn’t just syntax. It’s architecture. Boundaries matter. In code and in life. #Python #JavaScript #BackendJourney #SoftwareEngineering #WomenInTech
To view or add a comment, sign in
-
-
𝐒𝐭𝐨𝐩 𝐟𝐢𝐠𝐡𝐭𝐢𝐧𝐠 𝐲𝐨𝐮𝐫 𝐖𝐞𝐛 𝐅𝐫𝐚𝐦𝐞𝐰𝐨𝐫𝐤. I got tired of the "Standard" way of building Python web apps: ❌ Massive node_modules just for a single button. ❌ Wrestling with SQL just to save a simple List. ❌ Writing messy HTML strings inside my Python logic. So, I built web-in-python-lol. It’s a zero-dependency, pure Python framework designed for speed, simplicity, and composition. It moves away from complex templates and treats your database like a smart dictionary. The Highlights: 🔹 Smart Persistence: Forget json.loads(). Use app.store("tasks", my_list) and it’s in the DB. The engine handles the translation for you. 🔹 Component-Driven UI: Build interfaces with Card(), Row(), and Navbar() directly in Python. No HTML/CSS context switching. 🔹 Built-in Error Boundaries: Logic crashes are caught by a specialized safety net and rendered as a debug page. No more server restarts after every typo. 🔹 Dynamic Regex Routing: Create flexible URLs like /member/(.+) that pass variables directly to your functions. Built entirely on the Python Standard Library (HTTP, CGI, Re, Json). No Flask, no Django, no bloat. Just pure, unadulterated speed for "Hunters" who want to build and ship. Join the dark side of Python web dev. 🕸️ Check out the repo in the first comment! 👇 #Python #WebDevelopment #OpenSource #SoftwareEngineering #ShadowUI #Coding #Minimalism
To view or add a comment, sign in
-
-
Your Python API can handle 20,000 requests per second. Yep - Python. With FastAPI. I’ve been building with it quite a bit recently, and honestly what surprised me wasn’t just the performance - it was how smooth the developer experience feels. • Async-native • Docs generated automatically • Pydantic catching bad data early • Type hints that actually make coding nicer But the biggest lesson for me? FastAPI is easy to start… and very easy to structure badly. Most examples keep everything in main.py. That’s fine for a demo. Not so fine once things grow. What’s worked well for me is keeping things layered: Request → Controller → Service → Repository → Database Simple separation. Easier testing. Way less chaos later. I put together a deeper write-up with examples and comparisons (Django / Flask included) in case it helps anyone building a Python backend right now. Sharing it below Curious - what are you all using for APIs these days?
To view or add a comment, sign in
-
Excited to share a new integration: anymap-ts by Qiusheng Wu works beautifully with Panel for building interactive mapping applications in Python. What is anymap-ts? anymap-ts provides a unified Python API across 8 different JavaScript mapping libraries — MapLibre, Leaflet, DeckGL, OpenLayers, Mapbox, Cesium, KeplerGL, and Potree. Write your map code once, swap the backend class, and everything just works: basemaps, draw controls, GeoJSON layers, arc layers. How does it work with Panel? Since anymap-ts is built on anywidget (which implements the ipywidgets protocol), the integration is straightforward: from anymap_ts import Map import panel as pn pn.extension("ipywidgets") m = Map(center=[-122.4194, 37.7749], zoom=12) pn.pane.IPyWidget(m).servable() That's it. From there you can add Panel widgets to control the map — switch backends on the fly, adjust zoom and pitch with sliders, toggle basemaps. The showcase post includes a full multi-backend flight route demo with a dark-themed dashboard. Why this matters Choosing a mapping library usually locks you in. With anymap-ts + Panel, you can prototype on Leaflet, ship on MapLibre, and visualize large datasets on DeckGL — all with the same data pipeline and application code. Check out the full showcase with code and screenshots: anymap-ts repo: https://lnkd.in/e_KjeYuU
To view or add a comment, sign in
-
-
Recently, I’ve been exploring FastAPI and the broader Python backend ecosystem to better understand how everything works under the hood. Instead of stopping at the documentation, I decided to rebuild a minimal version of FastAPI myself. I’ve always been curious about the technical jargon we use daily and what’s actually happening beneath those abstractions. I went step by step: from the raw socket layer, to ASGI, to building request/response abstractions, implementing Trie-based routing, and wiring dependency injection and lifecycle handling. What surprised me most was that it wasn’t as difficult as I initially expected. The Python ecosystem makes much of this surprisingly approachable. What’s truly fascinating is how ASGI and event loops abstract low-level syscalls like kqueue and epoll, handling concurrency and I/O multiplexing for you. Once you understand that layering, modern Python frameworks feel less magical and more like clean compositions built on powerful, well-designed primitives. The most interesting part? Realizing how thin, yet incredibly powerful these abstraction layers really are. When you peel them back, you see that modern frameworks are not “magic,” but carefully composed systems built on top of simple, well-defined primitives. Building Trie-based routing was fun as well. Implementing a Trie data structure for efficient O(N) path resolution, handling dynamic parameters, and exposing the functionality through decorators to Python developers was a great learning experience. On top of that, designing chaining mechanisms and a registry-based dependency injection system was equally rewarding. It forces you to think carefully about composition, extensibility, and developer ergonomics. Going through ASGI from the ground up also reshaped how I think about concurrency, event loops, and framework architecture. What fascinated me most in this journey wasn’t simply re-coding a minimal version of FastAPI, but discovering the high level of interoperability across layers in the Python ecosystem. When you zoom out, you realize the Python backend ecosystem is not a monolith. It’s a set of beautifully layered, interoperable components: Sockets → Event Loop → Uvicorn (ASGI Server) → ASGI Interface → Frameworks/Libraries Frameworks like FastAPI or Starlette sit on top, focusing purely on developer ergonomics. That composability is what makes the ecosystem powerful. Understanding how these pieces connect from syscalls all the way to decorators, demystifies modern backend development. You can read my Missing Semester article on backend development on Medium: https://lnkd.in/dEzev7Aa My repo for MicroAPI: https://lnkd.in/duQ8KhCJ
To view or add a comment, sign in
Explore related topics
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development
👏🔥