Is there ever a reason you will need del? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Is there ever a reason you will need del?

Won't most objects simply go out of scope or be lost when their reference is reassigned? Is del more important for multithreading?

25th Jul 2016, 9:57 PM
Barcode
Barcode - avatar
2 Answers
+ 1
Suppose you have a database of list of students.. With new admission you'll need to include their details.. If some students leave the institute, "del" comes in handy..
28th Jul 2016, 12:26 PM
Prashant Shahi
Prashant Shahi - avatar
0
Let's say you have an file object that is outdated or not called upon for its value and for whatever reason never will be again this would be an good use for __del__ .
16th Dec 2016, 12:31 AM
Ronald Keith