A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-January/060034.html below:

[Python-Dev] The path module PEP

[Python-Dev] The path module PEP [Python-Dev] The path module PEPNick Coghlan ncoghlan at gmail.com
Tue Jan 24 23:10:15 CET 2006
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   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4