> This works as well > > file('filename.txt').readlines()[-1] > > Some will say that this is no good because the file is still open. > However I've been told that when the object is cleaned the file is > closed so it should be fine.
It matters in an implementation like Jython, which depends on the underlying Java runtime's garage collector to reap values. The issue there is that we don't control the frequency of the garbage collector, so we may exhaust all open files that the system provides before the collector kicks in. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor