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/045945.html below:

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

[Python-Dev] file() or open()?Skip Montanaro skip at pobox.com
Wed Jul 7 18:09:02 CEST 2004
    Guido> I recently saw a checkin that changed a call to open() into a
    Guido> call to file(), suggesting that using file() is more "politically
    Guido> correct" than open().

    Guido> I'm not sure I agree with this.  While open() and file() are
    Guido> currently aliases for the same object, this may not always be the
    Guido> case (it certainly wasn't always the case :-).  In the future, I
    Guido> could see open() become a factory function again that could
    Guido> return an instance of a different class depending on the mode
    Guido> argument, the default encoding for files, or who knows what; but
    Guido> file will always remain a class.

That was probably a checkin I made.  I would have left it alone except the
code was

    file = open(...)

As long as I was changing the variable name to not mask the builtin I
changed the call as well.  Had it been

    f = open(...)

I probably would have kept my hands off.

In any case, I was under the impression that file() was the wave of the
future and open() a nod to the past.

Skip
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