soumyadghosh.github.io

Python Mutable References with Caching (opens in new tab)

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[...

Read the original article
Sign in to keep reading the full article.

Keyboard Shortcuts

Navigation

Next / previous post
j/k
Open post
oorEnter
Preview post
v

Post Actions

Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Save / unsave
s

Recommendations

Add interest / feed
Enter
Not interested
x

Go to

Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Discover
gb
Search
/

General

Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help