When coding in Python, I sometimes use this syntax :
open(filename,'w').write("sometext")
As far as I know this causes Python's garbage-collector to close the file, but I've heard that the behavior of the GC is not defined and that might be problematic.
Is that true ? Should I always use this :
with open(filename) as f:
f.write()