On 2010-01-05, John Posner <jjpos...@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")

Alternatively:

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

-- 
Neil Cerutti
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to