158
you are viewing a single comment's thread
view the rest of the comments
[-] calcopiritus@lemmy.world 1 points 3 days ago

You can do some kind of RAII in python with the with keyword. Only works for local variables though, where it's easy to free resources manually

[-] tias@discuss.tchncs.de 2 points 3 days ago* (last edited 3 days ago)

But if you ever forget the with keyword, you have a leak. With proper RAII the resource acquisition and release is a property of the object's type and impossible to forget. RAII doesn't just mean "resource acquisition is initialization", it also implies "destruction is resource release".

this post was submitted on 06 Oct 2026
158 points (95.9% liked)

Programmer Humor

33564 readers
1520 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 3 years ago
MODERATORS