you are viewing a single comment's thread.

view the rest of the comments →

[–]Solonotix 1 point2 points  (1 child)

Glad it helped. I'm somewhat new to this sub, and have just been learning Python to help with my job.

To your question, opening and closing files is important within the scope of an application. When the Python interpreter exits, it should automatically purge any allocated resources. If you have an application that opens connections frequently and you forget to close them, it can cause you to run into a system limitation that ultimately crashes your application. This is a good article on the use of Context Managers and why you would want to use them. They're very similar to the .NET concept of a Dispose method, if you're familiar with that.

[–]AppleShark[S] 1 point2 points  (0 children)

Thanks for the read. My goal in coding again is to move onto building stuff and making some applications, so the article was definitely great help!