open-research / sumatra

http://neuralensemble.org/sumatra/
BSD 2-Clause "Simplified" License
127 stars 48 forks source link

Fix: Use `with` everywhere to open files #397

Open alcrene opened 7 months ago

alcrene commented 7 months ago

As far as I know, there is no advantage to using f = open() ... f.close() when with open() as f: will do. The with form deals better with corner cases where program execution ends unexpectedly, and is generally more Pythonic.