[Tutor] quick question to open(filename, 'r') vs. file(filename, 'r')

Alan Gauld alan.gauld at btinternet.com
Wed May 6 02:04:12 CEST 2009


"Larry Riedel" <Larry at Riedel.org> wrote

> It may not be a good reason, but I like that "open"
> is preferred, because in Java a "File" object is not
> a stream for the content in the file, just its directory
> entry, and simply creating a File object does not
> open the file at all.

I'm not sure citing anything Java does is a good rationale in 
Python! Hopefully we can do rather better than the horrors 
of Java :-)

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list