Ian Bicking wrote: > BJörn Lindqvist wrote: >> * Functions for reading and writing a whole file - better handled >> by file objects read() and write() methods. > > I would be disappointed to see this left out, because I get really tired > of this little dance: > > f = open(filename) > c = f.read() > f.close() > return c
Python 2.5 (well, once someone finds time to update mwh's patch): with open(filename) as f: return f.read() Behaviour guaranteed by language definition ;) Cheers, Nick. P.S. I too would really like to see this happen for 2.5. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --------------------------------------------------------------- http://www.boredomandlaziness.org _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com