[Tutor] Problem with file()

Bernard Lebel python at bernardlebel.com
Mon Aug 23 09:13:58 CEST 2004


----- Original Message ----- 
From: "Danny Yoo" <dyoo at hkn.eecs.berkeley.edu>
To: "Bernard Lebel" <python at bernardlebel.com>
Cc: <tutor at python.org>
Sent: Monday, August 23, 2004 3:44 AM
Subject: Re: [Tutor] Problem with file()


>
>
> On Sun, 22 Aug 2004, Bernard Lebel wrote:
>
> > All right, thanks everyone.
> > I followed all your suggestions and it works fine.
>
> That's wonderful!  But... err.. what was the problem?  *grin*
>
> To tell the truth, I didn't see the actual root of the problem; did the
> problem fix itself?  Oh, wait, ok, I see it now.
>
>     http://mail.python.org/pipermail/tutor/2004-August/031431.html
>
> So it was just the rebinding of the file() builtin!  Ok, that makes sense.

Correct! That's why I couldn't submit the faulty code, since I had no clue
that I was messing up things with my class thing. Anyway I got rid of the
classes, moved everything in the proper directories, removed everything from
the __init__.py file, and so on.



>
>
> Personally, I've been using open() instead of file() in my own code.  (I
> like to keep my functions as verbs.)  There was some discussion in another
> thread that suggests that open() is still the preferred way to do a file
> open:
>
>     http://mail.python.org/pipermail/python-dev/2004-July/045921.html
>
>
> Talk to you later!


Well..... on this very list people encouraged me to use the file()
constructor instead of open()!


Cheers
Bernard



More information about the Tutor mailing list