file_ref = open(string_ref)
Skip Montanaro
skip at pobox.com
Tue Apr 23 13:12:49 EDT 2002
Greg> Is this code
Greg> C1: file_ref = open(string_ref)
Greg> better than this?:
Greg> C2: file = open(string)
Greg> C1 is more accurate, given the view that data in Python are
Greg> references to objects. According to this view, the left-hand
Greg> variable names a reference to a file object.
Two things come to mind:
* everything's a reference, so "_ref" is redundant
* "file" is a builtin in 2.2 ("file is open" returns True)
Personally I prefer
f = open(string)
;-)
--
Skip Montanaro (skip at pobox.com - http://www.mojam.com/)
More information about the Python-list
mailing list