Dynamic text color

Neil Cerutti neilc at norwich.edu
Tue Jan 5 20:07:26 CET 2010

On 2010-01-05, John Posner <jjposner at optimum.net> wrote:
> 2. It's probably not the best idea to use a single variable
> (you use  "file") to do double-duty: to hold the name of a
> file, and to hold the  open-file object returned by the open()
> function. It's perfectly legal,  but it hides information that
> might be useful when you're debugging a  program. This is
> better:
>    fname = 'red.txt'
>    inpf = open(fname, "r")


>>> infile = open("red.txt", "r")
>>> infile.name

Neil Cerutti

More information about the Python-list mailing list