In article <[EMAIL PROTECTED]>, Ben Finney <[EMAIL PROTECTED]> wrote: >"Tim Peters" <[EMAIL PROTECTED]> writes: >> [John Salerno, on the difference between `open` and `file`] >>> >>> Interesting. What is the difference between them now? >> >> In 2.5 `file` is unchanged but `open` becomes a function: >> >>>>> file >> <type 'file'> >>>>> open >> <built-in function open> > >In that case I'll happily use 'file()', since it meshes nicely with >creating a new instance of any built-in type.
Nobody will prevent you from going against the standard decreed by Guido. But you also probably won't be able to contribute any code to the standard library, and other people mucking with your code who do care about Guido's decrees will probably change it. Unlike all the other built-in types, files are special because they are proxies for non-Python external objects. For that reason, there has long been interest in extending open() to work with file-like objects (such as URLs). Splitting open() and file() is a necessary precondition to making that happen, and it's also possible that Python 3.0 may have separate textfile and binary file objects. Finally, file() doesn't exist in Python 2.1 and earlier, and using file() instead of open() is gratuitous breakage. -- Aahz ([EMAIL PROTECTED]) <*> http://www.pythoncraft.com/ "I saw `cout' being shifted "Hello world" times to the left and stopped right there." --Steve Gonedes -- http://mail.python.org/mailman/listinfo/python-list