In some languages, you have very fine grained control of the lifetime of a variable by where you declare it. So for example, if you declare a variable in C++ or VB.net or whatever, when you leave the if block, the thing goes away. In Python, we don't have that. And whenever you have an attribute sitting on a class or sitting on instances, unless using slots, I'm not going into that, actually sitting in a dictionary that is a part of that object in memory. There's only to my knowledge, there's only three scopes in Python - global level, module level and function level.

Get the Snipd
podcast app

Unlock the knowledge in podcasts with the podcast player of the future.
App store bannerPlay store banner

AI-powered
podcast player

Listen to all your favourite podcasts with AI-powered features

Discover
highlights

Listen to the best highlights from the podcasts you love and dive into the full episode

Save any
moment

Hear something you like? Tap your headphones to save it with AI-generated key takeaways

Share
& Export

Send highlights to Twitter, WhatsApp or export them to Notion, Readwise & more

AI-powered
podcast player

Listen to all your favourite podcasts with AI-powered features

Discover
highlights

Listen to the best highlights from the podcasts you love and dive into the full episode