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/2004-July/045939.html below:

[Python-Dev] file() or open()?

[Python-Dev] file() or open()? [Python-Dev] file() or open()?Paul Prescod paul at prescod.net
Wed Jul 7 17:14:23 CEST 2004
Guido van Rossum wrote:

> I recently saw a checkin that changed a call to open() into a call to
> file(), suggesting that using file() is more "politically correct"
> than open().
> 
> I'm not sure I agree with this.  While open() and file() are currently
> aliases for the same object, this may not always be the case (it
> certainly wasn't always the case :-). 

I presumed file() was preferred to open() for the simple reason that it 
says more explicitly what you are doing. You are constructing a file 
object. "open()" doesn't say whether you are opening a file or socket or 
window or folder or ...

open made sense in a Unix world where "everything was a file" (except 
that even then it wasn't really) but it is a poor name for the file 
opening function in a 21st century language.

  Paul Prescod


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