Namaskar World.

Happy Exploring!!

Python Mutable References with Caching

So, while working with caching and scrapping, I understood the difference between immutable and mutable objects/datatypes very clearly. I had a scenario, where I am webscraping an API, the code looks like this. from aiocache import cached @cached(ttl=7200) async def get_forecast(station_id: str) -> list[dict]: data: dict = await scrape_weather(station_id) # doing some operation return forecasts and then using this utility tool in the endpoint. async def get_forecast_by_city( param: Annotated[StationIDQuery, Query()], ) -> list[UpcomingForecast]: forecasts_dict: list[dict] = await get_forecast(param.station_id) forecasts_dict.reversed() forecasts: deque[UpcomingForecast] = deque([]) for forecast in forecasts_dict: date_delta: int = ( date.fromisoformat(forecast["forecast_date"]) - date.today() ).days if date_delta <= 0: break forecasts.appendleft(UpcomingForecast.model_validate(forecast)) return list(forecasts) But, here is the gotcha, something I was doing inherently wrong. Lists in python are mutable objects. So, reversing the list modifies the list in place, without creating a new reference of the list. My initial approach was to do this ...

February 15, 2026 · 2 min

GSoC 2025 Final Submission: Re-architecting PyCups for a Modern, Pythonic Future

(Please note this is still a draft of my final blog) And just like that, my Google Summer of Code journey with OpenPrinting is drawing to a close. This post serves as a final summary of my project: rebuilding pycups from the ground up for libcups3. While I still have a few things I plan to update, this covers the core of my work over the summer. It’s been an incredible experience, and I’m excited to share the architectural decisions, challenges, and “magic” tricks that went into creating the new pycups. ...

November 9, 2025 · 5 min

GSOC: PyCups3 is Abstracting!

Why PyCups3 is So Damn Intelligent In my last blog , I shared just how smart PyCups3 is. This time, let’s go one layer deeper and see why it’s so intelligent. But first, let’s warm up with a bit of Python magic. ✨ What the Heck is a Dunder Method? Straight from the Python 3.x docs: Dunder methods (a.k.a. magic methods) are special methods you can define in your classes to give them superpowers. These methods let you make your class objects behave like built-in Python types. They’re called dunder because they start and end with a double underscore — like __init__. ...

September 4, 2025 · 3 min