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

Programmer Humor

33524 readers
827 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
 
you are viewing a single comment's thread
view the rest of the comments
[โ€“] calcopiritus@lemmy.world 1 points 15 hours ago (1 children)

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 15 hours ago* (last edited 12 hours 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".